/** * Ugly hack for check situation when limb already included from another dir */ function lmb_cli_check_limb_instance($disable = false) { static $is_disabled = false; if ($disable) { $is_disabled = true; } if ($is_disabled || !($error = error_get_last())) { return; } ob_end_clean(); if (false !== strstr($error['message'], 'Cannot redeclare lmb_resolve_include_path()')) { taskman_sysmsg("You must use the same instance of Limb as in the project!\n"); exit(1); } }
function run($args = array()) { global $TASKMAN_CURRENT_TASK; if ($this->has_run || $this->is_running) { return; } $this->is_running = true; $this->args = $args; taskman_runtasks($this->_getBeforeDeps(), $args); taskman_runtasks($this->_getDeps(), $args); taskman_sysmsg("************************ Running task '" . $this->getName() . "' ************************\n"); $TASKMAN_CURRENT_TASK = $this; call_user_func_array($this->func, array($this->args)); taskman_runtasks($this->_getAfterDeps(), $args); $this->has_run = true; $this->is_running = false; }
function _write_new_messages_in_ts_file($file, $scanner) { $doc = new lmbTSDocument(); $doc->preserveWhiteSpace = false; $error = !$doc->load($file, LIBXML_NONET); if ($error) { taskman_sysmsg("can't load XML-data from " . $file); exit(1); } foreach ($scanner->getMessages() as $message) { $doc->addMessage($message); } if (false === $doc->save($file)) { taskman_sysmsg("can't write in file: {$file}"); exit(1); } }
/** *@todo must be "always", but always dont receive args by default */ function task_entity_parse_table_argument($args) { lmb_package_require('dbal'); $database_info = lmbToolkit::instance()->getDefaultDbConnection()->getDatabaseInfo(); taskman_msg('DATABASE: ' . $database_info->getName() . PHP_EOL); $table_name = lmb_cli_ask_for_option("Table name (could be 'all')"); if ('all' !== $table_name) { $tables = array($database_info->getTable($table_name)); } else { $tables = _filter_tables($database_info->getTables(), 'lmb_'); } if (!count($tables)) { taskman_sysmsg('No tables found in ' . $table_name); exit(1); } taskman_propset('TABLES', $tables); }
function sysmsg($msg) { return \taskman_sysmsg($msg); }
function run($args = array()) { global $TASKMAN_CURRENT_TASK; global $TASKMAN_STACK; $args_str = serialize($args); if (isset($this->has_run[$args_str]) && $this->has_run[$args_str] || $this->is_running) { return; } $this->is_running = true; $this->args = $args; try { if ($task_handler = taskman_config('task_handler')) { $task_handler($this); } taskman_runtasks($this->_getBeforeDeps(), $this->args); taskman_runtasks($this->_getDeps(), $this->args); taskman_sysmsg("************************ Running task '" . $this->getName() . "' ************************\n"); $bench = microtime(true); $TASKMAN_CURRENT_TASK = $this; $TASKMAN_STACK[] = $this; if ($replacer = $this->_getReplacingTask()) { taskman_runtask($replacer, $this->args); } else { call_user_func_array($this->func, array($this->args)); } array_pop($TASKMAN_STACK); taskman_runtasks($this->_getAfterDeps(), $this->args); taskman_sysmsg("************************* '" . $this->getName() . "' done (" . round(microtime(true) - $bench, 2) . " sec.)*************************\n"); $this->has_run[$args_str] = true; $this->is_running = false; } catch (Exception $e) { if ($error_handler = taskman_config('error_handler')) { $error_handler($e); } else { throw $e; } } }
/** * @desc Remove some old stuff */ function task_remove_old() { write_to_file('o'); taskman_sysmsg("Remove uselles files from '" . taskman_prop('PROJECT_DIR') . "'...\n"); }
function _i18n_taskman_err($message) { taskman_sysmsg("\n***ERROR***\n\n{$message}\n\n"); exit; }