本文整理汇总了PHP中Console::Message方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::Message方法的具体用法?PHP Console::Message怎么用?PHP Console::Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::Message方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Tick_Match_30_Minutes_05_Hours_Handler
public function Tick_Match_30_Minutes_05_Hours_Handler()
{
// every night
// 1. Clean-up temp uploads
$KeepThis = array('README');
$MonthAgo = strtotime('30 days ago');
$Directory = 'uploads/tmp';
if (!file_exists($Directory)) {
return;
}
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($Directory)) as $File) {
if (in_array($File->GetFilename(), $KeepThis)) {
continue;
}
$Pathname = $File->GetPathname();
if ($MonthAgo > $File->GetMTime()) {
unlink($Pathname);
}
Console::Message('Removed: ^3%s', $Pathname);
}
}
示例2: elseif
//ThanksLogModel::RecalculateDiscussionThankCount();
} elseif ($Argument == 'garbage') {
$Limit = Console::Argument('limit');
if (!$Limit) {
$Limit = 10;
}
$CommentDataSet = $SQL->Select('CommentID, DiscussionID, InsertUserID')->From('Comment')->OrderBy('DateInserted', 'desc')->Limit($Limit)->Get();
$Loop = Console::Argument('loop');
if (!is_numeric($Loop) || $Loop <= 0) {
$Loop = 1;
}
for ($i = 0; $i < $Loop; $i++) {
foreach ($CommentDataSet as $Comment) {
$InsertUserID = mt_rand(1, $MaxUserID);
$Fields = array('CommentID' => $Comment->CommentID);
$Fields['UserID'] = $Comment->InsertUserID;
$Fields['InsertUserID'] = $InsertUserID;
$Fields['DateInserted'] = Gdn_Format::ToDateTime();
if ($InsertUserID % 5 == 0) {
unset($Fields['CommentID']);
$Fields['DiscussionID'] = $Comment->DiscussionID;
}
$SQL->Insert('ThanksLog', $Fields);
Console::Message('Garbaged thank comment: %s', GetValue('CommentID', $Fields));
}
}
}
/* LUM_ThankfulPeople
CommentID
UserID
*/
示例3: substr
if (strpos($Pathname, '__') !== False) {
continue;
}
if (pathinfo($Pathname, PATHINFO_EXTENSION) != 'php') {
continue;
}
$Path = substr($Pathname, strlen(PATH_ROOT) + 1);
$PathArray = explode('/', $Path);
if (in_array($PathArray[0], array('themes', '_notes'))) {
continue;
}
$Codes = GetTranslationFromFile($Pathname);
if (count($Codes) == 0) {
continue;
}
Console::Message('^3%s ^1(%s)', $Path, count($Codes));
$StoreDirectory = 'applications/dashboard';
if (in_array($PathArray[0], array('applications', 'plugins'))) {
$StoreDirectory = $PathArray[0] . '/' . $PathArray[1];
}
if ($Type == 'near') {
$DefinitionsFile = dirname(__FILE__) . '/dummy-locale/' . $StoreDirectory . "/locale/{$LocaleName}.php";
} elseif ($Type == 'pack') {
$PackFile = ArrayValue(1, explode('/', $StoreDirectory));
$DefinitionsFile = dirname(__FILE__) . "/dummy-locale/{$LocaleName}/{$PackFile}.php";
}
$FileHash = md5_file($File->GetRealPath());
$FileUndefinedTranslation =& $UndefinedTranslation[$DefinitionsFile];
if (!is_array($FileUndefinedTranslation)) {
$FileUndefinedTranslation = array();
}
示例4: catch
try {
$PluginManager->CallEventHandlers($Handler, 'Tick', $Event);
//K('#'.$Event, (int)K('#'.$Event) + 1);
} catch (Exception $Exception) {
}
Console::Message('Tick: %s', $Event);
}
}
}
if ($Exception) {
throw $Exception;
}
if ($bLoop != False) {
$LastYearSeconds = $YearSeconds;
$SleepSeconds = 60 - YearSeconds() % 60;
Console::Message('Sleep (%s %s)', $SleepSeconds, Plural($SleepSeconds, 'second', 'seconds'));
// prevent tick in second while in loop
sleep($SleepSeconds);
}
} while ($bLoop);
$Database = Gdn::Database();
if ($Database != Null) {
$Database->CloseConnection();
}
unlink($InTickFile);
/* Example:
class ExamplePlugin implements Gdn_IPlugin {
public function Tick_Every_5_Minutes_Handler() {
示例5: dirname
<?php
require_once dirname(__FILE__) . '/../../../plugins/UsefulFunctions/bootstrap.console.php';
$SQL = Gdn::SQL();
$Px = $SQL->Database->DatabasePrefix;
$ChunkModel = new ChunkModel();
$Limit = Console::Argument('limit', 5);
if (!is_numeric($Limit) || $Limit <= 0) {
$Limit = 5;
}
Gdn::Config()->Set('Plugins.UsefulFunctions.LoremIpsum.Language', 'noIpsum', True, False);
/**
* Examples:
*
*/
Console::Message("Start.");
for ($i = 0; $i < $Limit; $i++) {
$Format = 'xHtml';
$Name = LoremIpsum(2);
$Body = LoremIpsum('p' . rand(2, 3));
$InsertUserID = rand(1, 5);
$Fields = compact('Format', 'Name', 'Body', 'InsertUserID');
$ChunkID = $ChunkModel->Save($Fields);
if (!$ChunkID) {
Console::Message('^1Error: %s', VarDump($ChunkModel->Validation->Results()));
return;
}
Console::Message("Saved ^3%s (%s)", $ChunkID, $Name);
}
示例6: implode
<?php
require_once implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', '..', 'plugins', 'UsefulFunctions', 'bootstrap.console.php'));
$Directory = new RecursiveDirectoryIterator('cache/ps');
foreach (new RecursiveIteratorIterator($Directory) as $File) {
$CachedFile = $File->GetPathName();
unlink($CachedFile);
Console::Message('Removed ^3%s', $CachedFile);
}
// + DtCss
$DirectoryAry = array(PATH_APPLICATIONS, PATH_PLUGINS, PATH_THEMES);
foreach ($DirectoryAry as $DirectoryPath) {
$Directory = new RecursiveDirectoryIterator($DirectoryPath);
foreach (new RecursiveIteratorIterator($Directory) as $File) {
$Basename = $File->GetBasename();
$Extension = pathinfo($Basename, 4);
$Filename = pathinfo($Basename, 8);
if ($Extension != 'css') {
continue;
}
if (!preg_match('/^[\\.\\w\\-]+\\-c\\-[a-z0-9]{5,7}$/', $Filename)) {
continue;
}
$CachedFile = $File->GetPathName();
unlink($CachedFile);
Console::Message('Removed ^3%s', $CachedFile);
}
}