本文整理汇总了PHP中GO::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::debug方法的具体用法?PHP GO::debug怎么用?PHP GO::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* The code that needs to be called when the cron is running
*
* If $this->enableUserAndGroupSupport() returns TRUE then the run function
* will be called for each $user. (The $user parameter will be given)
*
* If $this->enableUserAndGroupSupport() returns FALSE then the
* $user parameter is null and the run function will be called only once.
*
* @param CronJob $cronJob
* @param \GO\Base\Model\User $user [OPTIONAL]
*/
public function run(CronJob $cronJob, \GO\Base\Model\User $user = null)
{
\GO::session()->runAsRoot();
$usersStmt = \GO\Base\Model\User::model()->findByAttribute('mail_reminders', 1);
while ($userModel = $usersStmt->fetch()) {
\GO::debug("Sending mail reminders to " . $userModel->username);
$remindersStmt = \GO\Base\Model\Reminder::model()->find(\GO\Base\Db\FindParams::newInstance()->joinModel(array('model' => 'GO\\Base\\Model\\ReminderUser', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'reminder_id', 'tableAlias' => 'ru'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'ru')->addCondition('time', time(), '<', 'ru')->addCondition('mail_sent', '0', '=', 'ru')));
while ($reminderModel = $remindersStmt->fetch()) {
// $relatedModel = $reminderModel->getRelatedModel();
// var_dump($relatedModel->name);
// $modelName = $relatedModel ? $relatedModel->localizedName : \GO::t('unknown');
$subject = \GO::t('reminder') . ': ' . $reminderModel->name;
$time = !empty($reminderModel->vtime) ? $reminderModel->vtime : $reminderModel->time;
date_default_timezone_set($userModel->timezone);
$body = \GO::t('time') . ': ' . date($userModel->completeDateFormat . ' ' . $userModel->time_format, $time) . "\n";
$body .= \GO::t('name') . ': ' . str_replace('<br />', ',', $reminderModel->name) . "\n";
// date_default_timezone_set(\GO::user()->timezone);
$message = \GO\Base\Mail\Message::newInstance($subject, $body);
$message->addFrom(\GO::config()->noreply_email, \GO::config()->title);
$message->addTo($userModel->email, $userModel->name);
\GO\Base\Mail\Mailer::newGoInstance()->send($message, $failedRecipients);
if (!empty($failedRecipients)) {
trigger_error("Reminder mail failed for recipient: " . implode(',', $failedRecipients), E_USER_NOTICE);
}
$reminderUserModelSend = \GO\Base\Model\ReminderUser::model()->findSingleByAttributes(array('user_id' => $userModel->id, 'reminder_id' => $reminderModel->id));
$reminderUserModelSend->mail_sent = 1;
$reminderUserModelSend->save();
}
date_default_timezone_set(\GO::user()->timezone);
}
}
示例2: rebuildCache
public function rebuildCache($user_id, $force = false)
{
$lastBuildTime = $force ? 0 : \GO::config()->get_setting('files_shared_cache_ctime', $user_id);
if (!$lastBuildTime || $this->_getLastMtime($user_id) > $lastBuildTime) {
$home = \GO\Files\Model\Folder::model()->findHomeFolder(GO::user());
$homeFolder = $home->path;
\GO::debug("Rebuilding shared cache");
$this->deleteByAttribute('user_id', $user_id);
$stmt = $this->_findShares($user_id);
//sort by path and only list top level shares
$shares = array();
while ($folder = $stmt->fetch()) {
//$folder->checkFsSync();
//sort by path and only list top level shares
$shares[$folder->path] = $folder;
}
ksort($shares);
foreach ($shares as $path => $folder) {
$isSubDir = isset($lastPath) && strpos($path . '/', $lastPath . '/') === 0;
$isInHome = strpos($path . '/', $homeFolder . '/') === 0;
if (!$isSubDir && !$isInHome) {
$sharedRoot = new SharedRootFolder();
$sharedRoot->user_id = $user_id;
$sharedRoot->folder_id = $folder->id;
$sharedRoot->save();
$lastPath = $path;
}
}
\GO::config()->save_setting('files_shared_cache_ctime', time(), $user_id);
return time();
} else {
return $lastBuildTime;
}
}
示例3: includeZpushFiles
public static function includeZpushFiles()
{
$moduleFolder = self::getModuleFolder();
\GO::debug("Using z-push folder: " . $moduleFolder);
if (self::zpushAdminFileExists($moduleFolder)) {
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/utils/zpushadmin.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/zpushdefs.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/zpush.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/stateobject.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/syncparameters.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/bodypreference.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/contentparameters.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/synccollections.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/zlog.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/statemanager.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/streamer.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/asdevice.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/interprocessdata.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/core/loopdetection.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/exceptions/exceptions.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/utils/utils.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/utils/zpushadmin.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/request/request.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/request/requestprocessor.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/ibackend.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/ichanges.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/iexportchanges.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/iimportchanges.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/isearchprovider.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/interface/istatemachine.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncobject.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncbasebody.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncbaseattachment.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncmailflags.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncrecurrence.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncappointment.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncappointmentexception.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncattachment.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncattendee.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncmeetingrequestrecurrence.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncmeetingrequest.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncmail.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncnote.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/synccontact.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncfolder.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncprovisioning.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/synctaskrecurrence.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/synctask.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncoofmessage.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncoof.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncuserinformation.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncdeviceinformation.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncdevicepassword.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/lib/syncobjects/syncitemoperationsattachment.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/config.php';
include_once \GO::config()->root_path . 'modules/' . $moduleFolder . '/version.php';
set_include_path(get_include_path() . PATH_SEPARATOR . BASE_PATH);
\ZPush::CheckConfig();
}
}
示例4: move
/**
* Moves a file from one location to another
*
* @param string $sourcePath The path to the file which should be moved
* @param string $destinationPath The full destination path, so not just the destination parent node
* @return int
*/
public function move($sourcePath, $destinationPath)
{
\GO::debug("ObjectTree::move({$sourcePath}, {$destinationPath})");
$moveable = $this->getNodeForPath($sourcePath);
$destination = $this->getNodeForPath(dirname($destinationPath));
$targetServerPath = $destination->getServerPath() . '/' . \GO\Base\Fs\File::utf8Basename($destinationPath);
$moveable->move($targetServerPath);
}
示例5: save
public static function save(&$file)
{
try {
if (\GO::router()->getController() && \GO::router()->getController()->getRoute() != 'maintenance') {
Model\Filesearch::model()->createFromFile($file, !empty(\GO::config()->filesearch_direct_index));
}
} catch (\Exception $e) {
\GO::debug((string) $e);
}
}
示例6: getChildren
/**
* Returns an array with all the child nodes
*
* @return Sabre\DAV\INode[]
*/
public function getChildren()
{
\GO::debug('Shared::getChildren()');
$shares = \GO\Files\Model\Folder::model()->getTopLevelShares(\GO\Base\Db\FindParams::newInstance()->limit(100));
$nodes = array();
foreach ($shares as $folder) {
$nodes[] = new \GO\DAV\FS\Directory($folder->path);
}
return $nodes;
}
示例7: __construct
public function __construct(Account $account, $attributes)
{
$this->_account = $account;
\GO::debug("GO\\Email\\Model\\ImapMailbox:" . var_export($attributes, true));
$this->_attributes = $attributes;
// if(isset($this->_attributes['name']))
// $this->_attributes['name']=\GO\Base\Mail\Utils::utf7_decode($this->_attributes["name"]);
//throw new \Exception(var_export($attributes, true));
//$this->_children = array();
}
示例8: move
/**
* Movesthe node
*
* @param string $name The new name
* @return void
*/
public function move($newPath)
{
$this->checkWritePermission();
\GO::debug('DAVFile::move(' . $this->path . ' -> ' . $newPath . ')');
$destFsFolder = new \GO\Base\Fs\Folder(dirname($newPath));
$destFolder = \GO\Files\Model\Folder::model()->findByPath($destFsFolder->stripFileStoragePath());
$file = \GO\Files\Model\File::model()->findByPath($this->relpath);
$file->folder_id = $destFolder->id;
$file->name = \GO\Base\Fs\File::utf8Basename($newPath);
$file->save();
$this->relpath = $file->path;
$this->path = \GO::config()->file_storage_path . $this->relpath;
}
示例9: run
/**
* The code that needs to be called when the cron is running
*
* If $this->enableUserAndGroupSupport() returns TRUE then the run function
* will be called for each $user. (The $user parameter will be given)
*
* If $this->enableUserAndGroupSupport() returns FALSE then the
* $user parameter is null and the run function will be called only once.
*
* @param \GO\Base\Cron\CronJob $cronJob
* @param \GO\Base\Model\User $user [OPTIONAL]
*/
public function run(\GO\Base\Cron\CronJob $cronJob, \GO\Base\Model\User $user = null)
{
\GO::session()->runAsRoot();
\GO::debug("Start updating public calendars.");
$calendars = \GO\Calendar\Model\Calendar::model()->findByAttribute('public', true);
foreach ($calendars as $calendar) {
$file = new \GO\Base\Fs\File($calendar->getPublicIcsPath());
if (!$file->exists()) {
\GO::debug("Creating " . $file->path() . ".");
$file->touch(true);
}
$file->putContents($calendar->toVObject());
\GO::debug("Updating " . $calendar->name . " to " . $file->path() . ".");
}
\GO::debug("Finished updating public calendars.");
}
示例10: beforeLogin
public static function beforeLogin($params, &$response)
{
$oldIgnoreAcl = \GO::setIgnoreAclPermissions(true);
$ia = new Authenticator();
if ($ia->setCredentials($params['username'], $params['password'])) {
if ($ia->imapAuthenticate()) {
if (!$ia->user) {
\GO::debug("IMAPAUTH: Group-Office user doesn't exist.");
if (!isset($params['first_name'])) {
$response['needCompleteProfile'] = true;
$response['success'] = false;
$response['feedback'] = \GO::t('pleaseCompleteProfile', 'imapauth');
return false;
} else {
//user doesn't exist. create it now
$user = new \GO\Base\Model\User();
$user->email = $ia->email;
$user->username = $ia->goUsername;
$user->password = $ia->imapPassword;
$user->first_name = $params['first_name'];
$user->middle_name = $params['middle_name'];
$user->last_name = $params['last_name'];
try {
if (!$user->save()) {
throw new \Exception("Could not save user: " . implode("\n", $user->getValidationErrors()));
}
if (!empty($ia->config['groups'])) {
$user->addToGroups($ia->config['groups']);
}
$ia->user = $user;
$user->checkDefaultModels();
//todo testen of deze regel nodig is om e-mail account aan te maken voor nieuwe gebruiker
$ia->createEmailAccount($user, $ia->config, $ia->imapUsername, $ia->imapPassword);
} catch (\Exception $e) {
\GO::debug('IMAPAUTH: Failed creating user ' . $ia->goUsername . ' and e-mail ' . $ia->email . 'Exception: ' . $e->getMessage(), E_USER_WARNING);
}
}
}
} else {
$response['feedback'] = GO::t('badLogin') . ' (IMAP)';
return false;
}
}
\GO::setIgnoreAclPermissions($oldIgnoreAcl);
}
示例11: afterDisplay
protected function afterDisplay(&$response, &$model, &$params)
{
\GO::debug(get_class($this));
$response['data']['photo_url'] = $model->photoThumbURL;
$response['data']['original_photo_url'] = $model->photoURL;
$response['data']['addressbook_name'] = $model->addressbook->name;
$response['data']['google_maps_link'] = \GO\Base\Util\Common::googleMapsLink($model->address, $model->address_no, $model->city, $model->country);
$response['data']['formatted_address'] = nl2br($model->getFormattedAddress());
$response['data']['post_google_maps_link'] = \GO\Base\Util\Common::googleMapsLink($model->post_address, $model->post_address_no, $model->post_city, $model->post_country);
$response['data']['post_formatted_address'] = nl2br($model->getFormattedPostAddress());
$response['data']['employees'] = array();
$sortAlias = \GO::user()->sort_name == "first_name" ? array('first_name', 'last_name') : array('last_name', 'first_name');
$stmt = $model->contacts(\GO\Base\Db\FindParams::newInstance()->order($sortAlias));
while ($contact = $stmt->fetch()) {
$response['data']['employees'][] = array('id' => $contact->id, 'name' => $contact->getName(\GO::user()->sort_name), 'function' => $contact->function, 'email' => $contact->email);
}
if (\GO::modules()->customfields && isset($response['data']['customfields']) && \GO\Customfields\Model\DisableCategories::isEnabled("GO\\Addressbook\\Model\\Company", $model->addressbook_id)) {
$ids = \GO\Customfields\Model\EnabledCategory::model()->getEnabledIds("GO\\Addressbook\\Model\\Company", $model->addressbook_id);
$enabled = array();
foreach ($response['data']['customfields'] as $cat) {
if (in_array($cat['id'], $ids)) {
$enabled[] = $cat;
}
}
$response['data']['customfields'] = $enabled;
}
if (\GO::modules()->isInstalled('customfields')) {
$response['data']['items_under_blocks'] = array();
$enabledBlocksStmt = \GO\Customfields\Model\EnabledBlock::getEnabledBlocks($model->addressbook_id, 'GO\\Addressbook\\Model\\Addressbook', $model->className());
foreach ($enabledBlocksStmt as $i => $enabledBlockModel) {
$items = $enabledBlockModel->block->getItemNames($model->id, $model->name);
if (!empty($items)) {
$blockedItemsEl = array('id' => $i, 'block_name' => $enabledBlockModel->block->name, 'items' => $items);
$blockedItemsEl['model_name'] = !empty($items[0]) ? $items[0]['model_name'] : '';
$modelNameArr = explode('_', $blockedItemsEl['model_name']);
$blockedItemsEl['type'] = !empty($modelNameArr[3]) ? $modelNameArr[3] : '';
$response['data']['items_under_blocks'][] = $blockedItemsEl;
}
}
}
return parent::afterDisplay($response, $model, $params);
}
示例12: runController
/**
* Runs a controller action with the given params
*
* @param array $params
*/
public function runController($params = false)
{
if (!$params) {
$params = array_merge($_REQUEST, \GO::request()->post);
}
$r = !empty($params['r']) ? explode('/', $params['r']) : array();
$this->_r = isset($params['r']) ? $params['r'] : "";
if (\GO::config()->debug || \GO::config()->debug_log) {
$log = 'Controller route r=';
if (isset($params['r'])) {
$log .= $params['r'];
} else {
$log = 'No r parameter given';
}
\GO::debug($log);
}
$first = isset($r[0]) ? ucfirst($r[0]) : 'Auth';
if (empty($r[2]) && file_exists(\GO::config()->root_path . 'controller/' . $first . 'Controller.php')) {
//this is a controller name that belongs to the Group-Office framework
$module = 'Core';
$controller = $first;
$action = isset($r[1]) ? $r[1] : '';
} else {
//it must be pointing to a module
$module = strtolower($r[0]);
$controller = isset($r[1]) ? ucfirst($r[1]) : 'Default';
$action = isset($r[2]) ? $r[2] : '';
}
$action = strtolower($action);
$controllerClass = 'GO\\';
if (!empty($module)) {
$controllerClass .= ucfirst($module) . '\\';
}
$controllerClass .= 'Controller\\' . $controller . 'Controller';
if (preg_match('/[^A-Za-z0-9_\\\\]+/', $controllerClass, $matches)) {
$err = "Only these charactes are allowed in controller names: A-Za-z0-9_";
echo $err;
trigger_error($err, E_USER_ERROR);
}
$this->_action = $action;
if (!class_exists($controllerClass)) {
if (!headers_sent()) {
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
}
if (empty($_SERVER['QUERY_STRING'])) {
$_SERVER['QUERY_STRING'] = "[EMPTY QUERY_STRING]";
}
$errorMsg = "Controller('" . $controllerClass . "') not found: " . $_SERVER['QUERY_STRING'] . " " . var_export($_REQUEST, true);
echo '<h1>404 Not found</h1>';
echo '<p>' . $errorMsg . '</p>';
if (\GO::config()->debug) {
trigger_error($errorMsg, E_USER_ERROR);
}
}
try {
$this->_controller = new $controllerClass();
$this->_controller->run($action, $params);
} catch (Exception\NotFound $e) {
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
if (empty($_SERVER['QUERY_STRING'])) {
$_SERVER['QUERY_STRING'] = "[EMPTY QUERY_STRING]";
}
$errorMsg = "Controller action '" . $action . " not found in controller class '" . $controllerClass . "': " . $_SERVER['QUERY_STRING'] . " " . var_export($_REQUEST, true);
echo '<h1>404 Not found</h1>';
echo '<p>' . $errorMsg . '</p>';
if (\GO::config()->debug) {
trigger_error($errorMsg, E_USER_ERROR);
}
}
}
示例13: send_command
function send_command($command, $piped = false)
{
if ($piped) {
$final_command = '';
foreach ($command as $v) {
$final_command .= 'A' . $this->command_number() . ' ' . $v;
}
$command = $final_command;
} else {
$command = 'A' . $this->command_number() . ' ' . $command;
}
if (!is_resource($this->handle)) {
throw new \Exception("Lost connection to " . $this->server);
}
$this->lastCommand = $command;
if (!fputs($this->handle, $command)) {
throw new \Exception("Lost connection to " . $this->server);
// eturn false;
}
if (!empty(\GO::session()->values['debugSql'])) {
\GO::debug("S: " . $command);
}
$this->commands[trim($command)] = \GO\Base\Util\Date::getmicrotime();
}
示例14: fireEvent
/**
* Fire an event so that listener functions will be called.
*
* @param String $eventName Name fo the event
* @param Array $params Paramters for the listener function
*
* @return boolean If one listerner returned false it will stop execution of
* other listeners and will return false.
*/
public function fireEvent($eventName, $params = array())
{
$className = str_replace('\\', '-', get_class($this));
// do{
if (!isset(self::$listeners[$className])) {
//listeners array will be loaded from a file. Because addListener is only called once when there is no cache.
$listeners = array();
$cacheFile = \GO::config()->orig_tmpdir . 'cache/listeners/' . $className . '.php';
// $cacheFile = \GO::config()->orig_tmpdir.'cache/listeners/'.$className.'.php';
if (file_exists($cacheFile)) {
require $cacheFile;
}
self::$listeners[$className] = $listeners;
}
if (isset(self::$listeners[$className][$eventName])) {
foreach (self::$listeners[$className][$eventName] as $listener) {
\GO::debug('Firing listener for class ' . $className . ' event ' . $eventName . ': ' . $listener[0] . '::' . $listener[1]);
$method = !empty($listener[0]) ? array($listener[0], $listener[1]) : $listener[1];
$return = call_user_func_array($method, $params);
if ($return === false) {
\GO::debug("Event '{$eventName}' cancelled by " . $listener[0] . '::' . $listener[1]);
return false;
}
}
}
// }
// while($className = get_parent_class($className));
return true;
}
示例15: _removeQuota
private function _removeQuota()
{
if (\GO::config()->quota > 0) {
\GO::debug("Removing quota: {$this->size}");
\GO::config()->save_setting("file_storage_usage", \GO::config()->get_setting('file_storage_usage') - $this->size);
}
if ($this->folder->quotaUser) {
$this->folder->quotaUser->calculatedDiskUsage(0 - $this->size)->save(true);
}
}