public static function import_default_tasks() { pake_desc('Display help on available commands'); pake_task('pakeInteractiveTask::help_pake'); pake_alias('?', 'pakeInteractiveTask::help_pake'); pake_desc('Quit interactive mode'); pake_task('pakeInteractiveTask::quit_pake'); }
pake_task('compile-settings', 'project_exists'); pake_alias('cs', 'compile-settings'); pake_desc('compile right'); pake_task('compile-rights', 'project_exists'); pake_alias('cr', 'compile-rights'); pake_desc('create module: <module_name> <lib>'); pake_task('create-module', 'project_exists'); pake_alias('cm', 'create-module'); pake_task('compress-files', 'project_exists'); pake_alias('cf', 'compress-files'); pake_task('newsletter', 'project_exists'); pake_alias('nl', 'newsletter'); pake_task('tags-relations', 'project_exists'); pake_alias('tr', 'tags-relations'); pake_task('url-relations', 'project_exists'); pake_alias('ur', 'url-relations'); function run_compress_files($task, $args) { define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', 'frontend'); define('SF_ENVIRONMENT', 'prod'); define('SF_DEBUG', false); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; //$files = FileHelper::getSubElements(SF_ROOT_DIR.DIRECTORY_SEPARATOR."www".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."frontend"); //$files = FileHelper::getSubElements(SF_ROOT_DIR.DIRECTORY_SEPARATOR."www".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."backend"); $files = FileHelper::getSubElements(SF_ROOT_DIR . DIRECTORY_SEPARATOR . "www" . DIRECTORY_SEPARATOR . "css"); foreach ($files as $file) { $ext = strrchr($file, "."); if ($ext != ".css" || $ext != ".js" || $ext != ".php") { continue; }
<?php // Task description pake_desc('synchronize a physical folder content with the asset library'); pake_task('sfassetlibrary-synchronize', 'project_exists'); pake_alias('sfals', 'sfassetlibrary-synchronize'); /** * * @param object $task * @param array $args */ function run_sfassetlibrary_synchronize($task, $args, $options) { if (!count($args)) { sfAssetsLibraryTools::log('Usage: php symfony sfassetlibrary-synchronize [app] [dirname] --notVerbose --removeOrphanAssets --removeOrphanFolders'); return; } $app = $args[0]; if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) { throw new Exception('The app "' . $app . '" does not exist.'); } if (!isset($args[1])) { throw new Exception('You must define a sychronization folder'); } $base_folder = $args[1]; $verbose = array_key_exists('notVerbose', $options) ? false : true; $removeOrphanAssets = array_key_exists('removeOrphanAssets', $options) ? true : false; $removeOrphanFolders = array_key_exists('removeOrphanFolders', $options) ? true : false; // define constants define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', $app);
<?php pake_import('pear', false); pake_task('default'); pake_alias('init_mvc', 'default'); pake_alias('reinit_db', 'default'); // TASKS function run_default($task, $args) { pake_echo_error('Installer is a separate tool now. Please use that'); try { pake_which('mvc_install'); pake_echo_comment('It is already installed on your system. Type: mvc_install'); } catch (pakeException $e) { pake_echo_comment('I will install it for you…'); pakePearTask::install_pear_package('midgardmvc_installer', 'pear.indeyets.pp.ru'); pake_echo_comment('Done. To use it, type: mvc_install'); } }
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ pake_desc('clear cached xmls'); pake_task('fb-clear-xml-cache', 'project_exists'); pake_alias('cx', 'fb-clear-xml-cache'); /** * clears xml files in the cache * * @example symfony fb-clear-xml-cache * @example symfony cx * * @param object $task * @param array $args */ function run_fb_clear_xml_cache($task, $args) { if (!file_exists('cache')) { throw new Exception('Cache directory does not exist.'); } $xml_cache_dir = sfConfig::get('sf_root_cache_dir') . "/atti"; // finder to remove all files in a cache directory $finder = pakeFinder::type('file')->ignore_version_control()->discard('.sf'); foreach ($args as $id) { $finder = $finder->name($id . ".xml");
<?php pake_task('index-documents', 'project_exists'); pake_alias('id', 'index-documents'); function run_index_documents($task, $args) { try { define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', 'backend'); define('SF_ENVIRONMENT', 'prod'); define('SF_DEBUG', false); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; ini_set("memory_limit", "2048M"); ini_set("display_errors", 1); $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); $search_config_file = SF_ROOT_DIR . '/config/search.xml'; $documents = simplexml_load_file($search_config_file); $all = 0; $search_index_path = SF_ROOT_DIR . '/cache/search/'; if (is_dir($search_index_path)) { $index_files = glob($search_index_path . '/*'); foreach ($index_files as $index_file) { if (is_file($index_file)) { unlink($index_file); } } } $search_index = Zend_Search_Lucene::create($search_index_path); $search_index->setMaxBufferedDocs(20000); Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
<?php // Task description pake_desc('create a root node for the asset library'); pake_task('sfassetlibrary-create-root', 'project_exists'); pake_task('sfassetlibrary-create-root', 'app_exists'); pake_alias('sfalcr', 'sfassetlibrary-create-root'); /** * * @param object $task * @param array $args */ function run_sfassetlibrary_create_root($task, $args) { $app = $args[0]; $env = empty($args[1]) ? 'dev' : $args[1]; // define constants define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', $app); define('SF_ENVIRONMENT', $env); define('SF_DEBUG', true); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; // initialize database manager $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); $con = Propel::getConnection(); if (sfAssetFolderPeer::getRoot()) { throw new sfException('The asset library already has a root'); } echo pakeColor::colorize(sprintf("Creating root node at %s...\n", sfConfig::get('app_sfAssetsLibrary_upload_dir', 'media')), 'COMMENT'); sfAssetFolderPeer::createRoot();
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ pake_desc('create classes for current model'); pake_task('propel-build-model', 'project_exists'); pake_alias('bm', 'propel-build-model'); pake_desc('create sql for current model'); pake_task('propel-build-sql', 'project_exists'); pake_alias('bs', 'propel-build-sql'); pake_desc('create schema.xml from existing database'); pake_task('propel-build-schema', 'project_exists'); pake_desc('create schema.xml from schema.yml'); pake_task('propel-convert-yml-schema', 'project_exists'); pake_desc('create schema.yml from schema.xml'); pake_task('propel-convert-xml-schema', 'project_exists'); pake_desc('load data from fixtures directory'); pake_task('propel-load-data', 'project_exists'); pake_desc('dump data to fixtures directory'); pake_task('propel-dump-data', 'project_exists'); pake_desc('create database for current model'); pake_task('propel-build-db', 'project_exists'); pake_desc('insert sql for current model'); pake_task('propel-insert-sql', 'project_exists'); pake_desc('generate propel model and sql and initialize database'); pake_task('propel-build-all', 'propel-build-model', 'propel-build-sql', 'propel-insert-sql');
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ pake_desc('clear cached information'); pake_task('clear-cache', 'project_exists'); pake_alias('cc', 'clear-cache'); pake_desc('clear controllers'); pake_task('clear-controllers', 'project_exists'); pake_desc('fix directories permissions'); pake_task('fix-perms', 'project_exists'); pake_desc('rotates an applications log files'); pake_task('log-rotate', 'app_exists'); pake_desc('purges an applications log files'); pake_task('log-purge', 'project_exists'); pake_desc('enables an application in a given environment'); pake_task('enable', 'app_exists'); pake_desc('disables an application in a given environment'); pake_task('disable', 'app_exists'); /** * fixes permissions in a symfony project * * @example symfony fix-perms * * @param object $task * @param array $args
*/ pake_desc('initialize a new symfony project'); pake_task('init-project'); pake_alias('new', 'init-project'); pake_desc('initialize a new symfony application'); pake_task('init-app', 'project_exists'); pake_alias('app', 'init-app'); pake_desc('initialize a new symfony module'); pake_task('init-module', 'app_exists'); pake_alias('module', 'init-module'); pake_desc('initialize a new symfony batch script'); pake_task('init-batch', 'project_exists'); pake_alias('batch', 'init-batch'); pake_desc('initialize a new symfony controller script'); pake_task('init-controller', 'app_exists'); pake_alias('controller', 'init-controller'); function run_init_project($task, $args) { if (file_exists('symfony')) { throw new Exception('A symfony project already exists in this directory.'); } if (!count($args)) { throw new Exception('You must provide a project name.'); } $project_name = $args[0]; $sf_root_dir = sfConfig::get('sf_root_dir'); // create basic project structure $finder = pakeFinder::type('any')->ignore_version_control()->discard('.sf'); pake_mirror($finder, sfConfig::get('sf_symfony_data_dir') . '/skeleton/project', $sf_root_dir); $finder = pakeFinder::type('file')->name('properties.ini', 'apache.conf', 'propel.ini'); pake_replace_tokens($finder, $sf_root_dir, '##', '##', array('PROJECT_NAME' => $project_name));