本文整理汇总了PHP中InstallUtil::runAutoBuildFromUpdateSchemaCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP InstallUtil::runAutoBuildFromUpdateSchemaCommand方法的具体用法?PHP InstallUtil::runAutoBuildFromUpdateSchemaCommand怎么用?PHP InstallUtil::runAutoBuildFromUpdateSchemaCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InstallUtil
的用法示例。
在下文中一共展示了InstallUtil::runAutoBuildFromUpdateSchemaCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Execute the action.
* @param array command line parameters specific for this command
*/
public function run($args)
{
set_time_limit('900');
if (!isset($args[0])) {
$this->usageError('A username must be specified.');
}
try {
Yii::app()->user->userModel = User::getByUsername($args[0]);
} catch (NotFoundException $e) {
$this->usageError('The specified username does not exist.');
}
$group = Group::getByName(Group::SUPER_ADMINISTRATORS_GROUP_NAME);
if (!$group->users->contains(Yii::app()->user->userModel)) {
$this->usageError('The specified user is not a super administrator.');
}
$startTime = microtime(true);
$template = "{message}\n";
$messageStreamer = new MessageStreamer($template);
$messageStreamer->setExtraRenderBytes(0);
$messageStreamer->add(Zurmo::t('Commands', 'Starting schema update process.'));
$messageLogger = new MessageLogger($messageStreamer);
InstallUtil::runAutoBuildFromUpdateSchemaCommand($messageLogger);
$messageStreamer->add(Zurmo::t('Commands', 'Autobuild complete, rebuilding read permissions.'));
if (SHOW_QUERY_DATA) {
$messageStreamer->add(PageView::getTotalAndDuplicateQueryCountContent());
}
ReadPermissionsOptimizationUtil::rebuild();
$messageStreamer->add(Zurmo::t('Commands', 'Rebuild read permissions complete.'));
$endTime = microtime(true);
$messageStreamer->add(Zurmo::t('Commands', 'Schema update complete.'));
$messageStreamer->add(Zurmo::t('Commands', 'Total run time: {formattedTime} seconds.', array('{formattedTime}' => number_format($endTime - $startTime, 3))));
if (SHOW_QUERY_DATA) {
$messageStreamer->add(PageView::getTotalAndDuplicateQueryCountContent());
}
}
示例2: testRunAutoBuildFromUpdateSchemaCommand
/**
* @depends testRunInstallation
*/
public function testRunAutoBuildFromUpdateSchemaCommand()
{
$this->runInstallation(true);
$super = User::getByUsername('super');
$super->primaryEmail->emailAddress = 'super@zurmo.com';
$this->assertTrue($super->save());
$this->assertEquals(0, EmailMessage::getCount());
$this->assertEquals(1, Notification::getCount());
$messageLogger = new MessageLogger();
$messageLogger->addInfoMessage(Zurmo::t('InstallModule', 'Starting schema update process.'));
$result = InstallUtil::runAutoBuildFromUpdateSchemaCommand($messageLogger);
$messageLogger->addInfoMessage(Zurmo::t('InstallModule', 'Schema update complete.'));
$this->assertTrue($result);
//No email notification is sent since allowSendingEmail is false
$this->assertEquals(0, EmailMessage::getCount());
$this->assertEquals(2, Notification::getCount());
}
示例3: testRunAutoBuildFromUpdateSchemaCommand
/**
* @depends testRunInstallation
*/
public function testRunAutoBuildFromUpdateSchemaCommand()
{
$this->runInstallation(true);
$messageLogger = new MessageLogger();
$messageLogger->addInfoMessage(Zurmo::t('InstallModule', 'Starting schema update process.'));
$result = InstallUtil::runAutoBuildFromUpdateSchemaCommand($messageLogger);
$messageLogger->addInfoMessage(Zurmo::t('InstallModule', 'Schema update complete.'));
$this->assertTrue($result);
}