本文整理汇总了PHP中AJXP_Logger::log2方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Logger::log2方法的具体用法?PHP AJXP_Logger::log2怎么用?PHP AJXP_Logger::log2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Logger
的用法示例。
在下文中一共展示了AJXP_Logger::log2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writePubliclet
/** Cypher the publiclet object data and write to disk.
* @param array $data The publiclet data array to write
* The data array must have the following keys:
* - DRIVER The driver used to get the file's content
* - OPTIONS The driver options to be successfully constructed (usually, the user and password)
* - FILE_PATH The path to the file's content
* - PASSWORD If set, the written publiclet will ask for this password before sending the content
* - ACTION If set, action to perform
* - USER If set, the AJXP user
* - EXPIRE_TIME If set, the publiclet will deny downloading after this time, and probably self destruct.
* - AUTHOR_WATCH If set, will post notifications for the publiclet author each time the file is loaded
* @param AbstractAccessDriver $accessDriver
* @param Repository $repository
* @param ShareStore $shareStore
* @param PublicAccessManager $publicAccessManager
* @return string|array An array containing the hash (0) and the generated url (1)
*/
public function writePubliclet(&$data, $accessDriver, $repository, $shareStore, $publicAccessManager)
{
$downloadFolder = $publicAccessManager->getPublicDownloadFolder();
$publicAccessManager->initFolder();
if (!is_dir($downloadFolder)) {
return "ERROR : Public URL folder does not exist!";
}
if (!function_exists("mcrypt_create_iv")) {
return "ERROR : MCrypt must be installed to use publiclets!";
}
$data["PLUGIN_ID"] = $accessDriver->getId();
$data["BASE_DIR"] = $accessDriver->getBaseDir();
//$data["REPOSITORY"] = $repository;
if (AuthService::usersEnabled()) {
$data["OWNER_ID"] = AuthService::getLoggedUser()->getId();
}
$shareStore->storeSafeCredentialsIfNeeded($data, $accessDriver, $repository);
// Force expanded path in publiclet
$copy = clone $repository;
$copy->addOption("PATH", $repository->getOption("PATH"));
$data["REPOSITORY"] = $copy;
if ($data["ACTION"] == "") {
$data["ACTION"] = "download";
}
try {
$hash = $shareStore->storeShare($repository->getId(), $data, "publiclet");
} catch (Exception $e) {
return $e->getMessage();
}
$shareStore->resetDownloadCounter($hash, AuthService::getLoggedUser()->getId());
$url = $publicAccessManager->buildPublicLink($hash);
AJXP_Logger::log2(LOG_LEVEL_INFO, __CLASS__, "New Share", array("file" => "'" . $copy->display . ":/" . $data['FILE_PATH'] . "'", "files" => "'" . $copy->display . ":/" . $data['FILE_PATH'] . "'", "url" => $url, "expiration" => $data['EXPIRE_TIME'], "limit" => $data['DOWNLOAD_LIMIT'], "repo_uuid" => $copy->uuid));
AJXP_Controller::applyHook("node.share.create", array('type' => 'file', 'repository' => &$copy, 'accessDriver' => &$accessDriver, 'data' => &$data, 'url' => $url));
return array($hash, $url);
}
示例2: logError
/**
* Write an error log with the plugin id as source
* @param string $prefix A quick description or action
* @param array|string $message Variable number of message args (string or array)
* @return void
*/
public function logError($prefix, $message)
{
$args = func_get_args();
array_shift($args);
AJXP_Logger::log2(LOG_LEVEL_ERROR, $this->getId(), $prefix, $args);
}