当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell::loadTasks方法代码示例

本文整理汇总了PHP中Shell::loadTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::loadTasks方法的具体用法?PHP Shell::loadTasks怎么用?PHP Shell::loadTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shell的用法示例。


在下文中一共展示了Shell::loadTasks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadTasks

 /**
  * Override loadTasks() to handle paths
  *
  * @access public
  */
 function loadTasks()
 {
     parent::loadTasks();
     $task = Inflector::classify($this->command);
     if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
         if (empty($this->{$task}->path)) {
             $path = Inflector::underscore(Inflector::pluralize($this->command));
             $this->{$task}->path = $this->params['working'] . DS . $path . DS;
         }
         if (isset($this->params['connection'])) {
             $this->{$task}->connection = $this->params['connection'];
         }
         foreach ($this->args as $i => $arg) {
             if (strpos($arg, '.')) {
                 list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
                 break;
             }
         }
         if (isset($this->params['plugin'])) {
             $this->{$task}->plugin = $this->params['plugin'];
         }
         if (!is_dir($this->{$task}->path)) {
             $this->err(sprintf(__("%s directory could not be found.\nBe sure you have created %s", true), $task, $this->{$task}->path));
             $this->_stop();
         }
     }
 }
开发者ID:enangyusup,项目名称:vbulletin-cakephp,代码行数:32,代码来源:bake.php

示例2: main

 function main()
 {
     parent::loadTasks();
     $this->out('Import Upload Shell');
     $this->hr();
     $this->_setAvailableImportFiles();
     if (empty($this->args)) {
         $imports = $this->_interactive();
     } else {
         $imports = $this->_determineImportIds(implode(' ', $this->args));
     }
     if (!empty($imports)) {
         foreach ($imports as $import) {
             $importUpload = $this->ImportUpload->create($import);
             if ($filename = $this->ImportUpload->filePath()) {
                 $importUpload['ImportUpload']['file_path'] = $filename;
                 if (!empty($import['ImportDelimiter'])) {
                     $options = array('delimiter' => $import['ImportDelimiter']['delimiter'], 'excel_reader' => $import['ImportDelimiter']['use_excel_reader'], 'qualifier' => $import['ImportUpload']['text_qualifier']);
                 }
                 if ($this->Parser->execute($filename, $options)) {
                     $this->ImportUpload->saveField('total', $this->Parser->getRowCount());
                     $this->ImportUpload->saveField('is_importing', 1);
                 }
                 die('here');
             } else {
             }
         }
     }
 }
开发者ID:nicoeche,项目名称:Finalus,代码行数:29,代码来源:import_upload.php

示例3: main

 /**
  * The main function, executed automatically when running the shell
  *
  */
 function main()
 {
     parent::loadTasks();
     $this->out('Build Search Index Shell');
     $this->hr();
     // Figure out which db config we are using
     $this->_setDbConfig();
     // Determine the models for the selected db config that have Searchable
     $this->_setAvailableModels();
     // If no args on command line, run interactively
     if (empty($this->args)) {
         $modelNames = $this->_interactive();
     } else {
         // Pass command line args off to validate input
         $modelNames = $this->_determineModelnames(implode(' ', $this->args));
     }
     foreach ($modelNames as $modelName) {
         // Confirm rebuild index for this model
         $skip = $this->in(__("Are you sure you want to rebuild the search index for {$modelName}, 'y' or 'n' or 'q' to exit", true), null, 'n');
         // Quit if they want to
         if (strtolower($skip) === 'q') {
             $this->out(__("Exit", true));
             $this->_stop();
         }
         // Skip if they want to
         if (strtolower($skip) !== 'y') {
             $this->out(__("Skipping " . $modelName, true));
             continue;
         }
         // Instantiate the model object
         $ModelObj = ClassRegistry::init($modelName);
         // Delete the records in the search index for the current model
         if (!$ModelObj->deleteSearchIndex(true)) {
             $this->err(__('Could not delete search index', true));
             $this->_stop();
         }
         // Find all records
         if (method_exists($ModelObj, 'getAllSearchableData')) {
             $records = $ModelObj->getAllSearchableData();
         } else {
             $records = $ModelObj->find('all', array('recursive' => 0));
         }
         foreach ($records as $record) {
             // Set model->data property
             $ModelObj->set($record);
             // Set the _records property of the Searchable Behavior
             $ModelObj->setSearchableRecords(false, true);
             // Save the search index record
             $ModelObj->saveSearchIndex(true);
             // Report progress
             $this->out($ModelObj->alias . ' ' . $ModelObj->id . ' ' . $record[$ModelObj->alias][$ModelObj->displayField]);
         }
     }
     $this->hr();
 }
开发者ID:TehTreag,项目名称:cakepackages,代码行数:59,代码来源:build_search_index.php

示例4: loadTasks

 /**
  * Override loadTasks() to handle paths
  *
  * @access public
  */
 function loadTasks()
 {
     parent::loadTasks();
     $task = Inflector::classify($this->command);
     if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
         $path = Inflector::underscore(Inflector::pluralize($this->command));
         $this->{$task}->path = $this->params['working'] . DS . $path . DS;
         if (!is_dir($this->{$task}->path)) {
             $this->err(sprintf(__("%s directory could not be found.\nBe sure you have created %s", true), $task, $this->{$task}->path));
             exit;
         }
     }
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:18,代码来源:bake.php

示例5: loadTasks

 function loadTasks()
 {
     Configure::write('debug', 0);
     //設置されているプラグインを取得
     $this->installed_plugins = getPlugins();
     foreach ($this->installed_plugins as $plugin) {
         $taskPath = APP . 'plugins' . DS . $plugin . DS . 'vendors' . DS . 'shells' . DS;
         $installerPath = APP . 'plugins' . DS . $plugin . DS . 'vendors' . DS . 'shells' . DS . 'tasks' . DS . "install_{$plugin}.php";
         if (file_exists($installerPath)) {
             $this->Dispatch->shellPaths[] = $taskPath;
             $this->tasks[] = $this->getPluginInstallerTaskName($plugin);
         }
     }
     parent::loadTasks();
 }
开发者ID:ap-craft,项目名称:lovelife_job,代码行数:15,代码来源:installer.php

示例6: loadTasks

	/**
	 * Override loadTasks() to handle paths
	 *
	 * @access public
	 */
	function loadTasks() {
		parent::loadTasks();
		$task = Inflector::classify($this->command);
		if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
			if (isset($this->params['connection'])) {
				$this->{$task}->connection = $this->params['connection'];
			}
			foreach($this->args as $i => $arg) {
				if (strpos($arg, '.')) {
					list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
					break;
				}
			}
			if (isset($this->params['plugin'])) {
				$this->{$task}->plugin = $this->params['plugin'];
			}
		}
	}
开发者ID:ralmeida,项目名称:FoundFree.org,代码行数:23,代码来源:bake.php

示例7: loadTasks

 /**
  * loadTasks method
  *
  * @return void
  * @access public
  */
 function loadTasks()
 {
     parent::loadTasks();
     foreach ($this->Find->settings as $key => $val) {
         if (isset($this->settings[$key])) {
             $this->Find->settings[$key] =& $this->settings[$key];
         }
     }
     $this->Find->startup();
 }
开发者ID:rodrigorm,项目名称:cake_autotest,代码行数:16,代码来源:repo.php


注:本文中的Shell::loadTasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。