当前位置: 首页>>代码示例>>PHP>>正文


PHP AuditEvent::getTailEvents方法代码示例

本文整理汇总了PHP中AuditEvent::getTailEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP AuditEvent::getTailEvents方法的具体用法?PHP AuditEvent::getTailEvents怎么用?PHP AuditEvent::getTailEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuditEvent的用法示例。


在下文中一共展示了AuditEvent::getTailEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the Zurmo
 * logo and Zurmo copyright notice. If the display of the logo is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display the words
 * "Copyright Zurmo Inc. 2014. All rights reserved".
 ********************************************************************************/
require_once '../../config/debug.php';
require_once '../common/bootstrap.php';
if (!($argc == 1 || $argc == 3 && $argv[1] == '-n' && is_numeric($argv[2]))) {
    echo "\nAuditLog - Displays the audit log.\nUsage:   php AuditLog.php [-n #]\nOptions: -n # Displays the tail of the log up to # entries.\n";
    exit;
}
$count = $argc == 3 ? intval($argv[2]) : null;
try {
    RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
} catch (Exception $e) {
    echo "Could not open the database.\n";
    exit;
}
try {
    Yii::app()->user->userModel = User::getByUsername('super');
} catch (Exception $e) {
    echo "Super user does not exist.\n";
    exit;
}
$AuditEventsList = $count === null ? AuditEvent::getAll() : AuditEvent::getTailEvents($count);
foreach ($AuditEventsList as $auditEvent) {
    $moduleName = $auditEvent->moduleName;
    echo $moduleName::stringifyAuditEvent($auditEvent) . "\n";
}
echo '(' . count($AuditEventsList) . " events)\n";
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:31,代码来源:AuditLog.php

示例2: testLogAuditEventForEachType

 public function testLogAuditEventForEachType()
 {
     Yii::app()->user->userModel = User::getByUsername('jimmy');
     $beforeCount = AuditEvent::getCount();
     $item = new AuditTestItem();
     $this->assertTrue($item->save());
     $this->assertEquals($beforeCount + 1, AuditEvent::getCount());
     $auditEvents = AuditEvent::getTailEvents(1);
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Created, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\)/', ZurmoModule::stringifyAuditEvent($auditEvents[0]));
     $item->dateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 120);
     $item->date = '2010-12-20';
     $item->float = 3.14159;
     $item->integer = 666;
     $item->time = '11:59';
     $this->assertTrue($item->save());
     $this->assertEquals($beforeCount + 6, AuditEvent::getCount());
     $auditEvents = AuditEvent::getTailEvents(5);
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date Time from \\(None\\) to [0-9]+/', ZurmoModule::stringifyAuditEvent($auditEvents[0]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date from \\(None\\) to 2010-12-20/', ZurmoModule::stringifyAuditEvent($auditEvents[1]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Float from \\(None\\) to 3.14159/', ZurmoModule::stringifyAuditEvent($auditEvents[2]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Integer from \\(None\\) to 666/', ZurmoModule::stringifyAuditEvent($auditEvents[3]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Time from \\(None\\) to 11:59/', ZurmoModule::stringifyAuditEvent($auditEvents[4]));
     $item->dateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $item->date = '2012-01-22';
     $item->float = 6.626068E-34;
     $item->integer = 69;
     $item->time = '12:00';
     $this->assertTrue($item->save());
     $this->assertEquals($beforeCount + 11, AuditEvent::getCount());
     $auditEvents = AuditEvent::getTailEvents(5);
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date from 2010-12-20 to 2012-01-22/', ZurmoModule::stringifyAuditEvent($auditEvents[1]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Float from 3.14159 to 6.626068E-34/', ZurmoModule::stringifyAuditEvent($auditEvents[2]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Integer from 666 to 69/', ZurmoModule::stringifyAuditEvent($auditEvents[3]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Time from 11:59 to 12:00/', ZurmoModule::stringifyAuditEvent($auditEvents[4]));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:35,代码来源:AuditingTest.php


注:本文中的AuditEvent::getTailEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。