本文整理汇总了PHP中Console::Argument方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::Argument方法的具体用法?PHP Console::Argument怎么用?PHP Console::Argument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::Argument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ThankfulPeoplePlugin
$MaxUserID = $SQL->Select('UserID', 'max', 'MaxUserID')->From('User')->Get()->FirstRow()->MaxUserID;
if ($Argument == 'structure') {
$ThankfulPeoplePlugin = new ThankfulPeoplePlugin();
$Drop = Console::Argument('drop') !== False;
$ThankfulPeoplePlugin->Structure($Drop);
} elseif ($Argument == 'calc') {
ThanksLogModel::RecalculateUserReceivedThankCount();
//ThanksLogModel::RecalculateCommentThankCount();
//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);
示例2: dirname
<?php
# Add this line to cron task file, 'crontab -e'
# */5 * * * * /usr/local/bin/php -q /path/to/plugins/UsefulFunctions/bin/tick.php
$InTickFile = dirname(__FILE__) . '/.tick';
if (file_exists($InTickFile)) {
$ModificationTime = filemtime($InTickFile);
if (strtotime('55 minutes ago') > $ModificationTime) {
unlink($InTickFile);
} else {
return;
}
}
touch($InTickFile);
require dirname(__FILE__) . '/../bootstrap.console.php';
$bLoop = Console::Argument('loop', False) !== False;
ini_set('memory_limit', '512M');
$Handler = new StdClass();
$Handler->Returns = array();
$Handler->EventArguments = array();
$PluginManager = Gdn::PluginManager();
$Ticks = array(60 => 'Minute', 3600 => 'Hour', 86400 => 'Day');
$Matches = array('Minutes' => 'i', 'Hours' => 'H', 'Day' => 'j', 'Month' => 'n');
$Events = array();
$Exception = Null;
$LastYearSeconds = 0;
do {
$YearSeconds = (int) (YearSeconds() / 60) * 60;
// rewind to begining of the minute
$Event = '';
foreach ($Matches as $Name => $Token) {
示例3: switch
$MaxScanFiles = 0;
}
$SkipTranslated = Console::Argument('skiptranslated') !== False;
$LocaleName = Console::Argument('locale');
if (!$LocaleName) {
$LocaleName = 'zz-ZZ';
}
$Type = Console::Argument('type');
switch ($Type) {
case 'near':
break;
case 'pack':
default:
$Type = 'pack';
}
$TestFile = Console::Argument('test');
if (file_exists($TestFile)) {
if (is_dir($TestFile)) {
$DigDirectory = $TestFile;
} else {
// TODO: cleanup here
$Codes = GetTranslationFromFile($TestFile);
d('TODO: cleanup here', $Codes);
}
} else {
$TestFile = False;
}
$Applications = array('Dashboard', 'Vanilla', 'Conversations');
$Applications = array_combine($Applications, array_map('strtolower', $Applications));
$T = Gdn::FactoryOverwrite(True);
$DefaultLocale = new Gdn_Locale('en-CA', $Applications, array());
示例4: 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);
}