[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 pake_desc('upgrade to a new symfony release'); 12 pake_task('upgrade'); 13 14 pake_desc('downgrade to a previous symfony release'); 15 pake_task('downgrade', 'project_exists'); 16 17 function run_downgrade($task, $args) 18 { 19 throw new Exception('I have no downgrade script for this release.'); 20 } 21 22 function run_upgrade($task, $args) 23 { 24 if (!isset($args[0])) 25 { 26 throw new Exception('You must provide the upgrade script to use (1.0 to upgrade to symfony 1.0 for example).'); 27 } 28 29 $version = $args[0]; 30 31 if ($version == '1.0') 32 { 33 run_upgrade_1_0($task, $args); 34 } 35 else 36 { 37 throw new Exception('I have no upgrade script for this release.'); 38 } 39 } 40 41 function run_upgrade_1_0($task, $args) 42 { 43 // check we have a project 44 if (!file_exists('symfony') && !file_exists('SYMFONY')) 45 { 46 throw new Exception('You must be in a symfony project directory'); 47 } 48 49 // upgrade propel.ini 50 _upgrade_1_0_propel_ini(); 51 52 // upgrade i18n support 53 _upgrade_1_0_i18n(); 54 55 // upgrade model classes 56 _upgrade_1_0_propel_model(); 57 58 // migrate activate to enabled 59 _upgrade_1_0_activate(); 60 61 // find all applications for this project 62 $apps = pakeFinder::type('directory')->name(sfConfig::get('sf_app_module_dir_name'))->mindepth(1)->maxdepth(1)->relative()->in(sfConfig::get('sf_apps_dir_name')); 63 64 // install symfony CLI 65 if (file_exists(sfConfig::get('sf_root_dir').'/SYMFONY')) 66 { 67 pake_remove(sfConfig::get('sf_root_dir').'/SYMFONY', ''); 68 } 69 pake_copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/project/symfony', sfConfig::get('sf_root_dir').'/symfony'); 70 pake_chmod('symfony', sfConfig::get('sf_root_dir'), 0777); 71 72 // update schemas 73 _upgrade_1_0_schemas(); 74 75 // add bootstrap files for tests 76 _add_1_0_test_bootstraps(); 77 78 // upgrade main config.php 79 _upgrade_1_0_main_config_php(); 80 81 // upgrade all applications 82 foreach ($apps as $app_module_dir) 83 { 84 $app = str_replace(DIRECTORY_SEPARATOR.sfConfig::get('sf_app_module_dir_name'), '', $app_module_dir); 85 pake_echo_action('upgrade 1.0', pakeColor::colorize(sprintf('upgrading application "%s"', $app), array('fg' => 'cyan'))); 86 87 $app_dir = sfConfig::get('sf_apps_dir_name').'/'.$app; 88 89 // upgrade config.php 90 _upgrade_1_0_config_php($app_dir); 91 92 // upgrade filters.yml 93 _upgrade_1_0_filters_yml($app_dir); 94 95 // upgrade all modules 96 $dir = $app_dir.'/'.sfConfig::get('sf_app_module_dir_name'); 97 if ($dir) 98 { 99 // template dirs 100 $template_dirs = pakeFinder::type('directory')->name('templates')->mindepth(1)->maxdepth(1)->in($dir); 101 $template_dirs[] = $app_dir.'/'.sfConfig::get('sf_app_template_dir_name'); 102 103 _upgrade_1_0_deprecated_for_templates($template_dirs); 104 105 _upgrade_1_0_date_form_helpers($template_dirs); 106 107 _upgrade_1_0_deprecated_for_generator($app_dir); 108 109 _upgrade_1_0_cache_yml($app_dir); 110 111 // actions dirs 112 $action_dirs = pakeFinder::type('directory')->name('actions')->mindepth(1)->maxdepth(1)->in($dir); 113 114 _upgrade_1_0_deprecated_for_actions($action_dirs); 115 116 // view.yml 117 _upgrade_1_0_view_yml($app_dir); 118 119 _upgrade_1_0_php_files($app_dir); 120 } 121 } 122 123 pake_echo_action('upgrade 1.0', 'done'); 124 125 pake_mkdirs(sfConfig::get('sf_root_dir').'/plugins'); 126 if (is_dir(sfConfig::get('sf_lib_dir').'/plugins')) 127 { 128 pake_echo_comment('WARNING: you must re-install all your plugins'); 129 } 130 131 pake_echo_comment('Now, you must:'); 132 pake_echo_comment(' - rebuild your model classes: symfony propel-build-model'); 133 pake_echo_comment(' - clear the cache: symfony cc'); 134 } 135 136 function _upgrade_1_0_i18n() 137 { 138 $dirs = array(sfConfig::get('sf_lib_dir_name'), sfConfig::get('sf_apps_dir_name')); 139 $finder = pakeFinder::type('file')->name('*.php'); 140 141 $seen = false; 142 foreach ($finder->in($dirs) as $php_file) 143 { 144 $content = file_get_contents($php_file); 145 146 $count = 0; 147 $content = str_replace('sfConfig::get(\'sf_i18n_instance\')', 'sfContext::getInstance()->getI18N()', $content, $count); 148 149 if ($count && !$seen) 150 { 151 $seen = true; 152 pake_echo_comment('sfConfig::get(\'sf_i18n_instance\') is deprecated'); 153 pake_echo_comment(' use sfContext::getInstance()->getI18N()'); 154 } 155 156 if ($count) 157 { 158 file_put_contents($php_file, $content); 159 } 160 } 161 } 162 163 function _upgrade_1_0_php_files($app_dir) 164 { 165 pake_echo_action('upgrade 1.0', 'upgrading sf/ path configuration'); 166 167 $php_files = pakeFinder::type('file')->name('*.php')->in($app_dir); 168 foreach ($php_files as $php_file) 169 { 170 $content = file_get_contents($php_file); 171 172 $deprecated = array( 173 "'/sf/js/prototype" => "sfConfig::get('sf_prototype_web_dir').'/js", 174 "'/sf/css/prototype" => "sfConfig::get('sf_prototype_web_dir').'/css", 175 "'/sf/js/sf_admin" => "sfConfig::get('sf_admin_web_dir').'/js", 176 "'/sf/css/sf_admin" => "sfConfig::get('sf_admin_web_dir').'/css", 177 "'/sf/images/sf_admin" => "sfConfig::get('sf_admin_web_dir').'/images", 178 ); 179 $seen = array(); 180 $updated = false; 181 foreach ($deprecated as $old => $new) 182 { 183 $count = 0; 184 $content = str_replace($old, $new, $content, $count); 185 if ($count) 186 { 187 $updated = true; 188 } 189 if ($count && !isset($seen[$old])) 190 { 191 $seen[$old] = true; 192 pake_echo_comment(sprintf('%s is deprecated', $old)); 193 pake_echo_comment(sprintf(' use %s', $new)); 194 } 195 } 196 197 if ($updated) 198 { 199 file_put_contents($php_file, $content); 200 } 201 } 202 } 203 204 function _upgrade_1_0_activate() 205 { 206 pake_echo_action('upgrade 1.0', 'migrate activate to enabled'); 207 208 $config_files = array( 209 'settings.yml' => array( 210 'activated_modules:' => 'enabled_modules: ', 211 ), 212 'cache.yml' => array( 213 'activate:' => 'enabled: ', 214 ), 215 'logging.yml' => array( 216 'active:' => 'enabled:', 217 ), 218 '*.php' => array( 219 'sf_logging_'.'active' => 'sf_logging_enabled', 220 ), 221 'apps/*/modules/*/validate/*.yml' => array( 222 'activate:' => 'enabled: ', 223 ), 224 ); 225 $seen = array(); 226 foreach ($config_files as $config_file => $changed) 227 { 228 list($dir, $config_file) = array(dirname($config_file), basename($config_file)); 229 $files = pakeFinder::type('file')->name($config_file)->in(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.$dir); 230 foreach ($files as $file) 231 { 232 $content = file_get_contents($file); 233 234 $updated = false; 235 foreach ($changed as $old => $new) 236 { 237 $content = str_replace($old, $new, $content, $count); 238 if ($count) 239 { 240 $updated = true; 241 } 242 if ($count && !isset($seen[$config_file.$old])) 243 { 244 $seen[$config_file.$old] = true; 245 246 pake_echo_comment(sprintf('%s is deprecated in %s', $old, $config_file)); 247 pake_echo_comment(sprintf(' use %s', $new)); 248 } 249 } 250 251 if ($updated) 252 { 253 file_put_contents($file, $content); 254 } 255 } 256 } 257 } 258 259 function _upgrade_1_0_view_yml($app_dir) 260 { 261 pake_echo_action('upgrade 1.0', 'upgrading view configuration'); 262 263 $yml_files = pakeFinder::type('file')->name('*.yml')->in($app_dir); 264 foreach ($yml_files as $yml_file) 265 { 266 $content = file_get_contents($yml_file); 267 268 $deprecated = array( 269 '/sf/js/prototype' => '%SF_PROTOTYPE_WEB_DIR%/js', 270 '/sf/css/prototype' => '%SF_PROTOTYPE_WEB_DIR%/css', 271 '/sf/js/sf_admin' => '%SF_ADMIN_WEB_DIR%/js', 272 '/sf/css/sf_admin' => '%SF_ADMIN_WEB_DIR%/css', 273 '/sf/images/sf_admin' => '%SF_ADMIN_WEB_DIR%/images', 274 ); 275 $seen = array(); 276 $updated = false; 277 foreach ($deprecated as $old => $new) 278 { 279 $count = 0; 280 $content = str_replace($old, $new, $content, $count); 281 if ($count) 282 { 283 $updated = true; 284 } 285 if ($count && !isset($seen[$old])) 286 { 287 $seen[$old] = true; 288 pake_echo_comment(sprintf('%s is deprecated', $old)); 289 pake_echo_comment(sprintf(' use %s', $new)); 290 } 291 } 292 293 if ($updated) 294 { 295 file_put_contents($yml_file, $content); 296 } 297 } 298 } 299 300 function _upgrade_1_0_cache_yml($app_dir) 301 { 302 pake_echo_action('upgrade 1.0', 'upgrading cache configuration'); 303 304 $yml_files = pakeFinder::type('files')->name('cache.yml')->in($app_dir); 305 306 $seen = false; 307 foreach ($yml_files as $yml_file) 308 { 309 $content = file_get_contents($yml_file); 310 311 $count = 0; 312 $updated = false; 313 $content = preg_replace_callback('/type\:(\s*)(.+)$/m', '_upgrade_1_0_cache_yml_callback', $content, -1, $count); 314 if ($count) 315 { 316 $updated = true; 317 } 318 if ($count && !$seen) 319 { 320 $seen = true; 321 pake_echo_comment('"type" has been removed in cache.yml'); 322 pake_echo_comment(' read the doc about "with_layout"'); 323 } 324 325 if ($updated) 326 { 327 file_put_contents($yml_file, $content); 328 } 329 } 330 } 331 332 function _upgrade_1_0_cache_yml_callback($match) 333 { 334 return 'with_layout:'.str_repeat(' ', max(1, strlen($match[1]) - 6)).(0 === strpos($match[2], 'page') ? 'true' : 'false'); 335 } 336 337 function _upgrade_1_0_deprecated_for_generator($app_dir) 338 { 339 pake_echo_action('upgrade 1.0', 'upgrading deprecated helpers in generator.yml'); 340 341 $yml_files = pakeFinder::type('files')->name('generator.yml')->in($app_dir); 342 343 $seen = array(); 344 $deprecated_str = array( 345 'admin_input_upload_tag' => 'admin_input_file_tag', 346 ); 347 foreach ($yml_files as $yml_file) 348 { 349 $updated = false; 350 foreach ($deprecated_str as $old => $new) 351 { 352 $content = file_get_contents($yml_file); 353 354 $count = 0; 355 $content = str_replace($old, $new, $content, $count); 356 if ($count) 357 { 358 $updated = true; 359 } 360 if ($count && !isset($seen[$old])) 361 { 362 $seen[$old] = true; 363 pake_echo_comment(sprintf('%s() has been removed', $old)); 364 pake_echo_comment(sprintf(' use %s()', $new)); 365 } 366 } 367 368 if ($updated) 369 { 370 file_put_contents($yml_file, $content); 371 } 372 } 373 } 374 375 function _upgrade_1_0_deprecated_for_actions($action_dirs) 376 { 377 pake_echo_action('upgrade 1.0', 'upgrading deprecated methods in actions'); 378 379 $php_files = pakeFinder::type('file')->name('*.php')->in($action_dirs); 380 foreach ($php_files as $php_file) 381 { 382 $content = file_get_contents($php_file); 383 384 $deprecated = array( 385 '$this->addHttpMeta' => '$this->getContext()->getResponse()->addHttpMeta', 386 '$this->addMeta' => '$this->getContext()->getResponse()->addMeta', 387 '$this->setTitle' => '$this->getContext()->getResponse()->setTitle', 388 '$this->addStylesheet' => '$this->getContext()->getResponse()->addStylesheet', 389 '$this->addJavascript' => '$this->getContext()->getResponse()->addJavascript', 390 ); 391 $seen = array(); 392 $updated = false; 393 foreach ($deprecated as $old => $new) 394 { 395 $count = 0; 396 $content = str_replace($old, $new, $content, $count); 397 if ($count) 398 { 399 $updated = true; 400 } 401 if ($count && !isset($seen[$old])) 402 { 403 $seen[$old] = true; 404 pake_echo_comment(sprintf('%s has been removed', $old)); 405 pake_echo_comment(sprintf(' use %s', $new)); 406 } 407 } 408 409 if ($updated) 410 { 411 file_put_contents($php_file, $content); 412 } 413 } 414 } 415 416 function _upgrade_1_0_date_form_helpers($template_dirs) 417 { 418 pake_echo_action('upgrade 1.0', 'upgrading date form helpers'); 419 420 $helpers = array( 421 'select_day_tag', 'select_month_tag', 'select_year_tag', 'select_date_tag', 'select_second_tag', 'select_minute_tag', 422 'select_hour_tag', 'select_ampm_tag', 'select_time_tag', 'select_datetime_tag', 'select_number_tag', 'select_timezone_tag', 423 ); 424 $regex = '/('.implode('|', $helpers).')/'; 425 426 $php_files = pakeFinder::type('file')->name('*.php')->in($template_dirs); 427 $seen = false; 428 foreach ($php_files as $php_file) 429 { 430 $updated = false; 431 432 $content = file_get_contents($php_file); 433 434 if (preg_match($regex, $content) && false === strpos($content, 'DateForm')) 435 { 436 $content = "<?php use_helper('DateForm') ?>\n\n".$content; 437 438 $updated = true; 439 if (!$seen) 440 { 441 $seen = true; 442 443 pake_echo_comment('date form helpers has been moved to the DateForm helper group'); 444 pake_echo_comment(' add use_helper(\'DateForm\')'); 445 } 446 } 447 448 if ($updated) 449 { 450 file_put_contents($php_file, $content); 451 } 452 } 453 } 454 455 function _upgrade_1_0_deprecated_for_templates($template_dirs) 456 { 457 pake_echo_action('upgrade 1.0', 'upgrading deprecated helpers'); 458 459 $php_files = pakeFinder::type('file')->name('*.php')->in($template_dirs); 460 $seen = array(); 461 $deprecated_str = array( 462 'use_helpers' => 'use_helper', 463 'object_admin_input_upload_tag' => 'object_admin_input_file_tag', 464 'input_upload_tag' => 'input_file_tag', 465 '$sf_last_module' => '$sf_context->getModuleName()', 466 '$sf_last_action' => '$sf_context->getActionName()', 467 '$sf_first_module' => '$sf_context->getActionStack()->getFirstEntry()->getModuleName()', 468 '$sf_first_action' => '$sf_context->getActionStack()->getFirstEntry()->getActionName()', 469 ); 470 foreach ($php_files as $php_file) 471 { 472 $content = file_get_contents($php_file); 473 474 $updated = false; 475 $count = 0; 476 477 foreach ($deprecated_str as $old => $new) 478 { 479 $content = str_replace($old, $new, $content, $count); 480 if ($count) 481 { 482 $updated = true; 483 } 484 if ($count && !isset($seen[$old])) 485 { 486 $seen[$old] = true; 487 pake_echo_comment(sprintf('%s has been removed', $old)); 488 pake_echo_comment(sprintf(' use %s', $new)); 489 } 490 } 491 492 if ($updated) 493 { 494 file_put_contents($php_file, $content); 495 } 496 } 497 } 498 499 function _upgrade_1_0_config_php($app_dir) 500 { 501 pake_echo_action('upgrade 1.0', 'upgrading config.php'); 502 503 pake_copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/app/app/config/config.php', $app_dir.DIRECTORY_SEPARATOR.sfConfig::get('sf_config_dir_name').DIRECTORY_SEPARATOR.'config.php'); 504 } 505 506 function _upgrade_1_0_filters_yml($app_dir) 507 { 508 pake_echo_action('upgrade 1.0', 'upgrading filters.yml'); 509 510 $configFile = $app_dir.DIRECTORY_SEPARATOR.sfConfig::get('sf_config_dir_name').DIRECTORY_SEPARATOR.'filters.yml'; 511 $content = file_get_contents($configFile); 512 513 // default symfony filters 514 $default = file_get_contents(sfConfig::get('sf_symfony_data_dir').'/skeleton/app/app/config/filters.yml'); 515 516 $placeholder = '# generally, you will want to insert your own filters here'; 517 518 // upgrade module filters.yml 519 $seen = false; 520 $yml_files = pakeFinder::type('file')->name('filters.yml')->in($app_dir.DIRECTORY_SEPARATOR.'modules'); 521 foreach ($yml_files as $yml_file) 522 { 523 $module_content = file_get_contents($yml_file); 524 525 if (false === strpos($module_content, 'rendering:')) 526 { 527 $lb = (strpos($module_content, "\r\n") !== false) ? "\r\n" : "\n"; 528 529 $module_content = str_replace($placeholder, $placeholder.$lb.$content.$lb.$module_content, $default); 530 531 file_put_contents($yml_file, $module_content); 532 533 if (!$seen) 534 { 535 pake_echo_comment('filters.yml now contains core symfony filters'); 536 } 537 538 $seen = true; 539 } 540 } 541 542 // upgrade app filters.yml 543 if (false === strpos($content, 'rendering:')) 544 { 545 $lb = (strpos($content, "\r\n") !== false) ? "\r\n" : "\n"; 546 $content = str_replace($placeholder, $placeholder.$lb.$content, $default); 547 548 file_put_contents($configFile, $content); 549 550 if (!$seen) 551 { 552 pake_echo_comment('filters.yml now contains core symfony filters'); 553 } 554 } 555 556 // upgrade project filters.yml 557 $configFile = sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'filters.yml'; 558 if (is_readable($configFile)) 559 { 560 $content = file_get_contents($configFile); 561 if (false === strpos($content, 'rendering:')) 562 { 563 $lb = (strpos($content, "\r\n") !== false) ? "\r\n" : "\n"; 564 $content = str_replace($placeholder, $placeholder.$lb.$content, $default); 565 566 file_put_contents($configFile, $content); 567 568 if (!$seen) 569 { 570 pake_echo_comment('filters.yml now contains core symfony filters'); 571 } 572 } 573 } 574 } 575 576 function _upgrade_1_0_main_config_php() 577 { 578 pake_echo_action('upgrade 1.0', 'upgrading main config.php'); 579 580 $content = file_get_contents(sfConfig::get('sf_root_dir').'/config/config.php'); 581 582 if (false === strpos($content, 'sf_symfony_lib_dir')) 583 { 584 pake_echo_comment('symfony lib and data dir are now configured in main config.php'); 585 586 $lib_dir = sfConfig::get('sf_symfony_lib_dir'); 587 $data_dir = sfConfig::get('sf_symfony_data_dir'); 588 if (is_link('lib/symfony') && is_link('data/symfony')) 589 { 590 $config = <<<EOF 591 592 593 \$sf_symfony_lib_dir = dirname(__FILE__).'/../lib/symfony'; 594 \$sf_symfony_data_dir = dirname(__FILE__).'/../data/symfony'; 595 596 EOF; 597 } 598 else 599 { 600 $config = <<<EOF 601 602 603 \$sf_symfony_lib_dir = '$lib_dir'; 604 \$sf_symfony_data_dir = '$data_dir'; 605 606 EOF; 607 } 608 609 $content = preg_replace('/^<\?php/s', '<?php'.$config, $content); 610 611 file_put_contents(sfConfig::get('sf_root_dir').'/config/config.php', $content); 612 } 613 } 614 615 function _upgrade_1_0_propel_model() 616 { 617 pake_echo_action('upgrade 1.0', 'upgrading require in models'); 618 619 $seen = false; 620 $php_files = pakeFinder::type('file')->name('*.php')->in(sfConfig::get('sf_lib_dir').'/model'); 621 foreach ($php_files as $php_file) 622 { 623 $content = file_get_contents($php_file); 624 625 $count1 = 0; 626 $count2 = 0; 627 $updated = false; 628 $content = str_replace('require_once \'model', 'require_once \'lib/model', $content, $count1); 629 $content = str_replace('include_once \'model', 'include_once \'lib/model', $content, $count2); 630 if ($count1 || $count2) 631 { 632 $updated = true; 633 } 634 if (($count1 || $count2) && !$seen) 635 { 636 $seen = true; 637 pake_echo_comment('model require must be lib/model/...'); 638 pake_echo_comment(' instead of model/...'); 639 } 640 641 if ($updated) 642 { 643 file_put_contents($php_file, $content); 644 } 645 } 646 } 647 648 function _upgrade_1_0_schemas() 649 { 650 pake_echo_action('upgrade 1.0', 'upgrading schemas'); 651 652 $seen = false; 653 $xml_files = pakeFinder::type('file')->name('*schema.xml')->in(sfConfig::get('sf_config_dir')); 654 foreach ($xml_files as $xml_file) 655 { 656 $content = file_get_contents($xml_file); 657 658 if (preg_match('/<database[^>]*package[^>]*>/', $content)) 659 { 660 continue; 661 } 662 663 $count = 0; 664 $updated = false; 665 $content = str_replace('<database', '<database package="lib.model"', $content, $count); 666 if ($count) 667 { 668 $updated = true; 669 } 670 if ($count && !$seen) 671 { 672 $seen = true; 673 pake_echo_comment('schema.xml must now have a database package'); 674 pake_echo_comment(' default is package="lib.model"'); 675 } 676 677 if ($updated) 678 { 679 file_put_contents($xml_file, $content); 680 } 681 } 682 } 683 684 function _upgrade_1_0_propel_ini() 685 { 686 pake_echo_action('upgrade 1.0', 'upgrading propel.ini configuration file'); 687 688 $propel_file = sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'propel.ini'; 689 690 if (is_readable($propel_file)) 691 { 692 $updated = false; 693 $propel_ini = file_get_contents($propel_file); 694 695 $count = 0; 696 697 // new target package (needed for new plugin system) 698 $propel_ini = preg_replace('#propel\.targetPackage(\s*)=(\s*)model#', 'propel.targetPackage$1=$2lib.model', $propel_ini, -1, $count); 699 if ($count) 700 { 701 $updated = true; 702 } 703 $propel_ini = preg_replace('#propel.php.dir(\s*)=(\s*)\${propel.output.dir}/lib#', 'propel.php.dir$1=$2\${propel.output.dir}', $propel_ini, -1, $count); 704 if ($count) 705 { 706 $updated = true; 707 } 708 709 if (false === strpos($propel_ini, 'propel.packageObjectModel')) 710 { 711 $updated = true; 712 $propel_ini = rtrim($propel_ini); 713 $propel_ini .= "\npropel.packageObjectModel = true\n"; 714 } 715 716 // new propel builder class to be able to remove require_* and strip comments 717 $propel_ini = str_replace('propel.engine.builder.om.php5.PHP5ExtensionObjectBuilder', 'addon.propel.builder.SfExtensionObjectBuilder', $propel_ini, $count); 718 if ($count) 719 { 720 $updated = true; 721 } 722 $propel_ini = str_replace('propel.engine.builder.om.php5.PHP5ExtensionPeerBuilder', 'addon.propel.builder.SfExtensionPeerBuilder', $propel_ini, $count); 723 if ($count) 724 { 725 $updated = true; 726 } 727 $propel_ini = str_replace('propel.engine.builder.om.php5.PHP5MultiExtendObjectBuilder', 'addon.propel.builder.SfMultiExtendObjectBuilder', $propel_ini, $count); 728 if ($count) 729 { 730 $updated = true; 731 } 732 $propel_ini = str_replace('propel.engine.builder.om.php5.PHP5MapBuilderBuilder', 'addon.propel.builder.SfMapBuilderBuilder', $propel_ini, $count); 733 if ($count) 734 { 735 $updated = true; 736 } 737 738 // replace old symfony.addon.propel path to addon.propel 739 $propel_ini = str_replace('symfony.addon.propel.builder.', 'addon.propel.builder.', $propel_ini, $count); 740 if ($count) 741 { 742 $updated = true; 743 } 744 745 if (false === strpos($propel_ini, 'addIncludes')) 746 { 747 $updated = true; 748 $propel_ini .= <<<EOF 749 750 propel.builder.addIncludes = false 751 propel.builder.addComments = false 752 propel.builder.addBehaviors = false 753 754 EOF; 755 756 pake_echo_comment('there are 3 new propel.ini options:'); 757 pake_echo_comment(' - propel.builder.addIncludes'); 758 pake_echo_comment(' - propel.builder.addComments'); 759 pake_echo_comment(' - propel.builder.addBehaviors'); 760 } 761 762 if ($updated) 763 { 764 file_put_contents($propel_file, $propel_ini); 765 } 766 } 767 } 768 769 function _add_1_0_test_bootstraps() 770 { 771 pake_echo_action('upgrade 1.0', 'add test bootstrap files'); 772 773 pake_mkdirs(sfConfig::get('sf_root_dir').'/test/bootstrap'); 774 775 pake_copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/project/test/bootstrap/functional.php', sfConfig::get('sf_root_dir').'/test/bootstrap/functional.php'); 776 pake_copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/project/test/bootstrap/unit.php', sfConfig::get('sf_root_dir').'/test/bootstrap/unit.php'); 777 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |