本文整理汇总了PHP中Minion_CLI类的典型用法代码示例。如果您正苦于以下问题:PHP Minion_CLI类的具体用法?PHP Minion_CLI怎么用?PHP Minion_CLI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Minion_CLI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _execute
protected function _execute(array $params)
{
$model = $params['model'];
$orm = ORM::factory($model);
$orm->send_search_mapping();
Minion_CLI::write('Search mapping for model ' . Minion_CLI::color($model, 'blue') . ' updated!');
}
开发者ID:modulargaming,项目名称:search,代码行数:7,代码来源:Mapping.php
示例2: modify_file
public static function modify_file($file, $content, $force = FALSE, $unlink = FALSE)
{
if ($unlink) {
$file_already_exists = is_file($file);
if ($file_already_exists) {
unlink($file);
Minion_CLI::write(Minion_CLI::color('Removed file ' . Debug::path($file), 'light_green'));
} else {
Minion_CLI::write(Minion_CLI::color('File does not exist ' . Debug::path($file), 'brown'));
}
} elseif ($force) {
$file_already_exists = is_file($file);
if (!is_dir(dirname($file))) {
mkdir(dirname($file), 0777, TRUE);
}
file_put_contents($file, $content);
if ($file_already_exists) {
Minion_CLI::write(Minion_CLI::color('Overwritten file ' . Debug::path($file), 'brown'));
} else {
Minion_CLI::write(Minion_CLI::color('Generated file ' . Debug::path($file), 'light_green'));
}
} else {
if (is_file($file)) {
Minion_CLI::write(Minion_CLI::color('File already exists ' . Debug::path($file), 'brown'));
} else {
if (!is_dir(dirname($file))) {
mkdir(dirname($file), 0777, TRUE);
}
file_put_contents($file, $content);
Minion_CLI::write(Minion_CLI::color('Generated file ' . Debug::path($file), 'light_green'));
}
}
}
开发者ID:Konro1,项目名称:pms,代码行数:33,代码来源:Generate.php
示例3: _execute
protected function _execute(array $params)
{
$vk = Vk::instance();
$user_ids = array();
$message = 'У вашего объявления обновился статус!';
$result = NULL;
try {
$user_ids = Utils::getNotifyUserIDs();
} catch (Database_Exception $e) {
Minion_CLI::write($e->getMessage());
return;
}
if (count($user_ids) == 0) {
Minion_CLI::write('no users');
return;
}
try {
$vk->login();
$result = $vk->api('secure.sendNotification', array('user_ids' => implode($user_ids, ','), 'message' => urlencode($message), 'client_secret' => $vk->config['VK_APP_SECRET']));
} catch (Kohana_Exception $e) {
Minion_CLI::write($e->getMessage());
return;
}
if (is_null($result)) {
Minion_CLI::write('wtf?');
return;
}
try {
Utils::uncheckUsersNotifyByIDs($user_ids);
} catch (Database_Exception $e) {
Minion_CLI::write($e->getMessage());
return;
}
Minion_CLI::write('done!');
}
开发者ID:kulaginds,项目名称:SevGUAdvertsVKApp,代码行数:35,代码来源:Cron.php
示例4: _execute
protected function _execute(array $params)
{
$db = Database::instance(Database::$default);
Minion_CLI::write('Exporting table structure to structure.sql');
try {
$rows = $db->query(Database::SELECT, 'show tables', FALSE);
$tables = [];
$views = [];
foreach ($rows as $row) {
$table = reset($row);
$res = $db->query(Database::SELECT, 'show create table `' . $table . '`', FALSE);
$res = $res[0];
$schema = Arr::get($res, 'Create Table', NULL);
if ($schema === NULL) {
$schema = Arr::get($res, 'Create View', NULL);
$schema = preg_replace('#^CREATE.*VIEW `#U', 'CREATE VIEW `', $schema);
if ($schema === NULL) {
continue;
}
$views[] = $schema . ';';
continue;
}
$tables[] = $schema . ';';
}
file_put_contents(Migration::config('dump') . 'structure.sql', implode("\n\n", $tables) . "\n\n" . implode("\n\n", $views));
Minion_CLI::write('OK');
} catch (Exception $ex) {
Minion_CLI::write('ERROR: ' . $ex->getMessage());
}
}
开发者ID:alshabalin,项目名称:kohana-advanced-migrations,代码行数:30,代码来源:Structure.php
示例5: _execute
/**
* Task to run pending migrations
*
* @return null
*/
protected function _execute(array $params)
{
$migrations = new MigrationManager();
Database::$default = $params['db'];
$this->db = Database::instance();
$db_config = Kohana::$config->load('database')->{$params['db']};
if (!ORM::factory('Migration')->is_installed()) {
/**
* Get platform from database config
*/
$platform = strtolower($db_config['type']);
if ('mysqli' == $platform) {
$platform = 'mysql';
}
/**
* Get SQL from file for selected platform
*/
$file = realpath(substr(__DIR__, 0, strlen(__DIR__) - strlen('classes/Task/Db')) . 'sql/' . $platform . '.sql');
$handle = fopen($file, 'rb');
$sql_create = fread($handle, filesize($file));
$this->db->query(0, $sql_create);
$msg = Minion_CLI::color("-----------------------------\n", 'green');
$msg .= Minion_CLI::color("| Migration table create!!! |\n", 'green');
$msg .= Minion_CLI::color("-----------------------------\n", 'green');
Minion_CLI::write($msg);
}
$migrations->migrate($params['db'], $params['step']);
}
开发者ID:rafis,项目名称:migrations,代码行数:33,代码来源:Migrate.php
示例6: execute
public function execute(array $options)
{
$db = $this->db_params($options['database']);
$file = $options['file'] ? $options['file'] : Kohana::$config->load("migrations.path") . DIRECTORY_SEPARATOR . 'schema.sql';
$command = strtr("mysqldump -u:username -p:password --skip-comments --add-drop-database --add-drop-table --no-data :database | sed 's/AUTO_INCREMENT=[0-9]*\\b//' > :file ", array(':username' => $db['username'], ':password' => $db['password'], ':database' => $db['database'], ':file' => $file));
Minion_CLI::write('Saving structure of database "' . $db['database'] . '" to ' . Debug::path($file), 'green');
system($command);
}
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:8,代码来源:dump.php
示例7: execute
/**
* Execute the task
*
* @param array Configuration
*/
public function execute(array $config)
{
try {
$file = $this->generate($config);
Minion_CLI::write('Migration generated: ' . $file);
} catch (ErrorException $e) {
Minion_CLI::write($e->getMessage());
}
}
开发者ID:reflectivedevelopment,项目名称:jfh-lib,代码行数:14,代码来源:new.php
示例8: _execute
/**
* Execute the task
*
* @param array $options Configuration
*/
protected function _execute(array $options)
{
try {
$file = $this->generate($options);
Minion_CLI::write('Migration generated: ' . $file);
} catch (ErrorException $e) {
Minion_CLI::write($e->getMessage());
}
}
开发者ID:evopix,项目名称:minion-database,代码行数:14,代码来源:Make.php
示例9: _execute
/**
* Task to rollback last executed migration
*
* @return null
*/
protected function _execute(array $params)
{
$migrations = new MigrationManager();
Database::$default = $params['db'];
if (!ORM::factory('Migration')->is_installed()) {
Minion_CLI::write('Migrations is not installed. Please Run the migrations.sql script in your mysql server');
exit;
}
$migrations->rollback($params['db'], $params['step']);
}
开发者ID:rafis,项目名称:migrations,代码行数:15,代码来源:Rollback.php
示例10: _execute
protected function _execute(array $params)
{
if (!Migration::is_installed()) {
Migration::install();
}
if (Migration::generate($params['name'], $params['columns']) === TRUE) {
Minion_CLI::write('Migration \'' . $params['name'] . '\' was succefully created');
} else {
Minion_CLI::write('An error occured while creating migration \'' . $params['name'] . '\'');
}
}
开发者ID:alshabalin,项目名称:kohana-advanced-migrations,代码行数:11,代码来源:Migration.php
示例11: execute
public function execute(array $options)
{
if ($options['force'] === NULL or 'yes' === Minion_CLI::read('This will destroy all data in the current database. Are you sure? [yes/NO]')) {
Minion_CLI::write('Dropping Tables', 'green');
$migrations = new Migrations(array('log' => 'Minion_CLI::write'));
$migrations->clear_all();
Minion_Task::factory('db:migrate')->execute($options);
} else {
Minion_CLI::write('Nothing done', 'brown');
}
}
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:11,代码来源:recreate.php
示例12: increase_message_field_size
public function increase_message_field_size()
{
$db = Database::instance();
$cols = $db->list_columns($this->tbl);
if ($cols['message']['data_type'] != 'longtext') {
Minion_CLI::write("Increasing length of message field to LONGTEXT");
$msgcol = $db->quote_column('message');
$sql = "ALTER TABLE " . $db->quote_table($this->tbl) . " CHANGE {$msgcol} {$msgcol} LONGTEXT NOT NULL";
$db->query(NULL, $sql);
}
}
开发者ID:samwilson,项目名称:kohana_mailqueue,代码行数:11,代码来源:Upgrade.php
示例13: _execute
/**
* Task to build a new migration file
*
* @return null
*/
protected function _execute(array $params)
{
$migrations = new MigrationManager();
$status = $migrations->generate_migration($params['name']);
if ($status == 0) {
Minion_CLI::write('Migration ' . $params['name'] . ' was succefully created');
Minion_CLI::write('Please check migrations folder');
} else {
Minion_CLI::write('There was an error while creating migration ' . $params['name']);
}
}
开发者ID:rafis,项目名称:migrations,代码行数:16,代码来源:Migration.php
示例14: _execute
/**
* Execute the task and copy the required files
*
* @param array $params the command options
*
* @return void
*/
protected function _execute(array $params)
{
// Identify the vendor and destination path
$vendor_path = $params['vendor-path'];
$public_path = $params['public-path'];
// Publish the twitter bootstrap js at DOCROOT/assets/js/twbs
$this->copy_files($vendor_path . '/twbs/bootstrap/js', '/\\.js$/', $public_path . '/js/twbs');
Minion_CLI::write(Minion_CLI::color('Published bootstrap javascripts to ' . $public_path . '/js/twbs', 'green'));
// Publish the font-awesome font files as DOCROOT/assets/font
$this->copy_files($vendor_path . '/fortawesome/font-awesome/font', '/^fontawesome/i', $public_path . '/font');
Minion_CLI::write(Minion_CLI::color('Published font-awesome font to ' . $public_path . '/font', 'green'));
}
开发者ID:ingenerator,项目名称:kohana-twbs,代码行数:19,代码来源:Publishassets.php
示例15: _execute
protected function _execute(array $params)
{
if ($params['database'] > 0) {
Model_Backup::factory($params['folder'] . 'db-' . date('YmdHis') . '.sql')->create()->save();
Minion_CLI::write(__('Database backup created successfully'));
}
if ($params['filesystem'] > 0) {
if (Model_Backup::factory($params['folder'] . 'filesystem-' . date('YmdHis') . '.zip')->create()) {
Minion_CLI::write(__('Filesystem backup created successfully'));
}
}
}
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:12,代码来源:backup.php
示例16: execute
public function execute(array $options)
{
$db = $this->db_params($options['database']);
$file = $options['file'] ? $options['file'] : Kohana::$config->load("migrations.path") . DIRECTORY_SEPARATOR . 'schema.sql';
if ($options['force'] === NULL or 'yes' === Minion_CLI::read("This will destroy database " . $db['database'] . " Are you sure? [yes/NO]")) {
$command = strtr("mysql -u:username -p:password :database < :file ", array(':username' => $db['username'], ':password' => $db['password'], ':database' => $db['database'], ':file' => $file));
Minion_CLI::write('Loading data from ' . Debug::path($file) . ' to ' . $db['database'], 'green');
system($command);
} else {
Minion_CLI::write('Nothing done', 'brown');
}
}
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:12,代码来源:load.php
示例17: _execute
protected function _execute(array $params)
{
Minion_CLI::write('Change status videos!');
$video = Model_Links::updatePublish();
//
if ($video) {
$message = "OK";
} else {
$message = "Error";
}
Log::instance()->add(Log::INFO, "Update videos task are {$message}");
Log::instance()->write();
}
开发者ID:alextoshinov,项目名称:musyme,代码行数:13,代码来源:Checkvideos.php
示例18: _execute
protected function _execute(array $options)
{
$config = $this->config($options['name']);
$config = array_merge($config, $options);
$file = DOCROOT . $config['file'];
$file = strtr($file, array(":timestamp" => strtotime('now')));
Minion_CLI::write('Generating ' . json_encode($config));
$filters = is_array($config['filter']) ? $config['filter'] : explode(',', $config['filter']);
$content = $this->feed_content($config['model'], (array) $filters, $config['view']);
Minion_CLI::write('Done.');
Minion_CLI::write('Saving feed content to ' . Debug::path($file));
file_put_contents($file, $content);
Minion_CLI::write('Done.');
}
开发者ID:openbuildings,项目名称:jam-generated-feed,代码行数:14,代码来源:Generate.php
示例19: _execute
protected function _execute(array $params)
{
try {
if ($params['use_sleep'] == 1) {
$status = Email_Queue::batch_send_with_sleep();
} else {
$status = Email_Queue::batch_send();
}
Minion_CLI::write('============ Report ==========');
Minion_CLI::write(__('Total emails sent - :num', array(':num' => $status['sent'])));
Minion_CLI::write(__('Total emails failed - :num', array(':num' => $status['failed'])));
} catch (Exception $e) {
Minion_CLI::write($e->getMessage());
}
}
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:15,代码来源:queue.php
示例20: _execute
protected function _execute(array $params)
{
$mask = '*.php';
if ($params['name'] !== NULL) {
$mask = $params['name'] . '.php';
}
$seeds = glob(Migration::config('seeds') . $mask);
if ($seeds !== FALSE && count($seeds)) {
foreach ($seeds as $seed) {
Minion_CLI::write('Seeding \'' . basename($seed, '.php') . '\'');
include $seed;
Minion_CLI::write('OK');
}
} else {
Minion_CLI::write('Nothing to seed');
}
}
开发者ID:alshabalin,项目名称:kohana-advanced-migrations,代码行数:17,代码来源:Seed.php
注:本文中的Minion_CLI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论