本文整理汇总了PHP中AJXP_Logger类的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Logger类的具体用法?PHP AJXP_Logger怎么用?PHP AJXP_Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AJXP_Logger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: authenticate
public function authenticate(Sabre\DAV\Server $server, $realm)
{
//AJXP_Logger::debug("Try authentication on $realm", $server);
try {
$success = parent::authenticate($server, $realm);
} catch (Exception $e) {
$success = 0;
$errmsg = $e->getMessage();
if ($errmsg != "No digest authentication headers were found") {
$success = false;
}
}
if ($success) {
$res = AuthService::logUser($this->currentUser, null, true);
if ($res < 1) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
$this->updateCurrentUserRights(AuthService::getLoggedUser());
if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
$webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
}
} else {
if ($success === false) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
}
throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
}
ConfService::switchRootDir($this->repositoryId);
return true;
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:31,代码来源:class.AJXP_Sabre_AuthBackendDigest.php
示例2: parseSpecificContributions
protected function parseSpecificContributions(&$contribNode)
{
parent::parseSpecificContributions($contribNode);
if (isset($this->actions["share"])) {
$disableSharing = false;
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
if ($downloadFolder == "") {
$disableSharing = true;
} else {
if (!is_dir($downloadFolder) || !is_writable($downloadFolder)) {
AJXP_Logger::debug("Disabling Public links, {$downloadFolder} is not writeable!", array("folder" => $downloadFolder, "is_dir" => is_dir($downloadFolder), "is_writeable" => is_writable($downloadFolder)));
$disableSharing = true;
} else {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && AuthService::isReservedUserId($loggedUser->getId())) {
$disableSharing = true;
}
} else {
$disableSharing = true;
}
}
}
if ($disableSharing) {
unset($this->actions["share"]);
$actionXpath = new DOMXPath($contribNode->ownerDocument);
$publicUrlNodeList = $actionXpath->query('action[@name="share"]', $contribNode);
$publicUrlNode = $publicUrlNodeList->item(0);
$contribNode->removeChild($publicUrlNode);
}
}
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:32,代码来源:class.ShareCenter.php
示例3: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (!isset($httpVars["simple_uploader"]) && !isset($httpVars["xhr_uploader"])) {
return false;
}
AJXP_Logger::debug("SimpleUploadProc is active");
$result = $postProcessData["processor_result"];
if (isset($httpVars["simple_uploader"])) {
print "<html><script language=\"javascript\">\n";
if (isset($result["ERROR"])) {
$message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext('" . str_replace("'", "\\'", $message) . "');";
} else {
print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext();";
}
print "</script></html>";
} else {
if (isset($result["ERROR"])) {
$message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
exit($message);
} else {
exit("OK");
}
}
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:25,代码来源:class.SimpleUploadProcessor.php
示例4: createFile
/**
* Creates a new file in the directory
*
* Data will either be supplied as a stream resource, or in certain cases
* as a string. Keep in mind that you may have to support either.
*
* After succesful creation of the file, you may choose to return the ETag
* of the new file here.
*
* The returned ETag must be surrounded by double-quotes (The quotes should
* be part of the actual string).
*
* If you cannot accurately determine the ETag, you should not return it.
* If you don't store the file exactly as-is (you're transforming it
* somehow) you should also not return an ETag.
*
* This means that if a subsequent GET to this new file does not exactly
* return the same contents of what was submitted here, you are strongly
* recommended to omit the ETag.
*
* @param string $name Name of the file
* @param resource|string $data Initial payload
* @return null|string
*/
public function createFile($name, $data = null)
{
try {
$name = ltrim($name, "/");
AJXP_Logger::debug("CREATE FILE {$name}");
AJXP_Controller::findActionAndApply("mkfile", array("dir" => $this->path, "filename" => $name), array());
if ($data != null && is_file($this->getUrl() . "/" . $name)) {
$p = $this->path . "/" . $name;
$this->getAccessDriver()->nodeWillChange($p, intval($_SERVER["CONTENT_LENGTH"]));
//AJXP_Logger::debug("Should now copy stream or string in ".$this->getUrl()."/".$name);
if (is_resource($data)) {
$stream = fopen($this->getUrl() . "/" . $name, "w");
stream_copy_to_stream($data, $stream);
fclose($stream);
} else {
if (is_string($data)) {
file_put_contents($data, $this->getUrl() . "/" . $name);
}
}
$toto = null;
$this->getAccessDriver()->nodeChanged($toto, $p);
}
$node = new AJXP_Sabre_NodeLeaf($this->path . "/" . $name, $this->repository, $this->getAccessDriver());
if (isset($this->children)) {
$this->children = null;
}
return $node->getETag();
} catch (Exception $e) {
AJXP_Logger::debug("Error " . $e->getMessage(), $e->getTraceAsString());
return null;
}
}
开发者ID:biggtfish,项目名称:cms,代码行数:56,代码来源:class.AJXP_Sabre_Collection.php
示例5: authenticate
public function authenticate(Sabre\DAV\Server $server, $realm)
{
$auth = new Sabre\HTTP\BasicAuth();
$auth->setHTTPRequest($server->httpRequest);
$auth->setHTTPResponse($server->httpResponse);
$auth->setRealm($realm);
$userpass = $auth->getUserPass();
if (!$userpass) {
$auth->requireLogin();
throw new Sabre\DAV\Exception\NotAuthenticated('No basic authentication headers were found');
}
// Authenticates the user
//AJXP_Logger::info(__CLASS__,"authenticate",$userpass[0]);
$confDriver = ConfService::getConfStorageImpl();
$userObject = $confDriver->createUserObject($userpass[0]);
$webdavData = $userObject->getPref("AJXP_WEBDAV_DATA");
if (empty($webdavData) || !isset($webdavData["ACTIVE"]) || $webdavData["ACTIVE"] !== true) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $userpass[0], "error" => "WebDAV user not found or disabled"));
throw new Sabre\DAV\Exception\NotAuthenticated();
}
// check if there are cached credentials. prevents excessive authentication calls to external
// auth mechanism.
$cachedPasswordValid = 0;
$secret = defined("AJXP_SECRET_KEY") ? AJXP_SECRET_KEY : "CDAFx¨op#";
$encryptedPass = md5($userpass[1] . $secret . date('YmdHi'));
if (isset($webdavData["TMP_PASS"]) && $encryptedPass == $webdavData["TMP_PASS"]) {
$cachedPasswordValid = true;
//AJXP_Logger::debug("Using Cached Password");
}
if (!$cachedPasswordValid && !$this->validateUserPass($userpass[0], $userpass[1])) {
AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $userpass[0], "error" => "Invalid WebDAV user or password"));
$auth->requireLogin();
throw new Sabre\DAV\Exception\NotAuthenticated('Username or password does not match');
}
$this->currentUser = $userpass[0];
$res = AuthService::logUser($this->currentUser, $userpass[1], true);
if ($res < 1) {
throw new Sabre\DAV\Exception\NotAuthenticated();
}
$this->updateCurrentUserRights(AuthService::getLoggedUser());
if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
AJXP_Safe::storeCredentials($this->currentUser, $userpass[1]);
}
if (isset($this->repositoryId) && ConfService::getRepositoryById($this->repositoryId)->getOption("AJXP_WEBDAV_DISABLED") === true) {
throw new Sabre\DAV\Exception\NotAuthenticated('You are not allowed to access this workspace');
}
ConfService::switchRootDir($this->repositoryId);
// the method used here will invalidate the cached password every minute on the minute
if (!$cachedPasswordValid) {
$webdavData["TMP_PASS"] = $encryptedPass;
$userObject->setPref("AJXP_WEBDAV_DATA", $webdavData);
$userObject->save("user");
AuthService::updateUser($userObject);
}
return true;
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:56,代码来源:class.AJXP_Sabre_AuthBackendBasic.php
示例6: catchError
function catchError($code, $message, $fichier, $ligne, $context)
{
if (error_reporting() == 0) {
return;
}
$message = "{$code} : {$message} in {$fichier} (l.{$ligne})";
AJXP_Logger::logAction("error", array("message" => $message));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage(null, $message, true);
AJXP_XMLWriter::close();
exit(1);
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:12,代码来源:class.AJXP_XMLWriter.php
示例7: __construct
/** Construction. This kills the current session if any started, and restart the given session */
public function __construct($name, $killPreviousSession = false, $loadPreviousSession = false, $saveHandlerType = "files", $saveHandlerData = null)
{
AJXP_Logger::debug("Switching to session " . $name);
if (session_id() == "") {
if (isset($saveHandlerData)) {
session_set_save_handler($saveHandlerData["open"], $saveHandlerData["close"], $saveHandlerData["read"], $saveHandlerData["write"], $saveHandlerData["destroy"], $saveHandlerData["gc"]);
} else {
if (ini_get("session.save_handler") != $saveHandlerType) {
ini_set('session.save_handler', $saveHandlerType);
}
}
// Start a default session and save on the handler
session_start();
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
session_write_close();
} else {
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
}
// Please note that there is no start here, session might be already started
if (session_id() != "") {
// There was a previous session
if ($killPreviousSession) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
}
AJXP_Logger::debug("Closing previous session " . session_name() . " / " . session_id());
session_write_close();
session_regenerate_id(false);
$_SESSION = array();
}
if (isset($saveHandlerData)) {
session_set_save_handler($saveHandlerData["open"], $saveHandlerData["close"], $saveHandlerData["read"], $saveHandlerData["write"], $saveHandlerData["destroy"], $saveHandlerData["gc"]);
} else {
if (ini_get("session.save_handler") != $saveHandlerType) {
ini_set('session.save_handler', $saveHandlerType);
}
}
if ($loadPreviousSession) {
AJXP_Logger::debug("Restoring previous session" . SessionSwitcher::$sessionArray[0]['id']);
session_id(SessionSwitcher::$sessionArray[0]['id']);
} else {
$newId = md5(SessionSwitcher::$sessionArray[0]['id'] . $name);
session_id($newId);
}
session_name($name);
session_start();
AJXP_Logger::debug("Restarted session " . session_name() . " / " . session_id(), $_SESSION);
}
开发者ID:biggtfish,项目名称:cms,代码行数:51,代码来源:sessionSwitcher.php
示例8: initRepository
function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$wrapperData = $this->detectStreamWrapper(true);
AJXP_Logger::debug("Detected wrapper data", $wrapperData);
$this->wrapperClassName = $wrapperData["classname"];
$this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
$consumerKey = $this->repository->getOption("CONSUMER_KEY");
$consumerSecret = $this->repository->getOption("CONSUMER_SECRET");
$oauth = new Dropbox_OAuth_PEAR($consumerKey, $consumerSecret);
// TOKENS IN SESSION?
if (!empty($_SESSION["OAUTH_DROPBOX_TOKENS"])) {
return;
}
// TOKENS IN FILE ?
$tokens = $this->getTokens($this->repository->getId());
if (!empty($tokens)) {
$_SESSION["OAUTH_DROPBOX_TOKENS"] = $tokens;
return;
}
// OAUTH NEGOCIATION
if (isset($_SESSION['DROPBOX_NEGOCIATION_STATE'])) {
$state = $_SESSION['DROPBOX_NEGOCIATION_STATE'];
} else {
$state = 1;
}
switch ($state) {
case 1:
$tokens = $oauth->getRequestToken();
//print_r($tokens);
// Note that if you want the user to automatically redirect back, you can
// add the 'callback' argument to getAuthorizeUrl.
//echo "Step 2: You must now redirect the user to:\n";
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 2;
$_SESSION['oauth_tokens'] = $tokens;
throw new Exception("Please go to <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"" . $oauth->getAuthorizeUrl() . "\">" . $oauth->getAuthorizeUrl() . "</a> to authorize the access to your dropbox. Then try again to switch to this repository.");
case 2:
$oauth->setToken($_SESSION['oauth_tokens']);
$tokens = $oauth->getAccessToken();
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 3;
$_SESSION['OAUTH_DROPBOX_TOKENS'] = $tokens;
$this->setTokens($this->repository->getId(), $tokens);
return;
}
throw new Exception("Impossible to find the tokens for accessing the dropbox repository");
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:50,代码来源:class.dropboxAccessDriver.php
示例9: switchAction
public function switchAction($action, $httpVars, $filesVars)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
return false;
}
if (!isset($this->pluginConf)) {
$this->pluginConf = array("GENERATE_THUMBNAIL" => false);
}
$streamData = $repository->streamData;
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
if ($action == "preview_data_proxy") {
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
if (isset($httpVars["get_thumb"]) && $this->pluginConf["GENERATE_THUMBNAIL"]) {
require_once INSTALL_PATH . "/plugins/editor.diaporama/PThumb.lib.php";
$pThumb = new PThumb($this->pluginConf["THUMBNAIL_QUALITY"]);
if (!$pThumb->isError()) {
$pThumb->remote_wrapper = $streamData["classname"];
$pThumb->use_cache = $this->pluginConf["USE_THUMBNAIL_CACHE"];
$pThumb->cache_dir = $this->pluginConf["THUMBNAIL_CACHE_DIR"];
$pThumb->fit_thumbnail($destStreamURL . $file, 200);
if ($pThumb->isError()) {
print_r($pThumb->error_array);
AJXP_Logger::logAction("error", $pThumb->error_array);
}
//exit(0);
} else {
print_r($pThumb->error_array);
AJXP_Logger::logAction("error", $pThumb->error_array);
}
} else {
$filesize = filesize($destStreamURL . $file);
$fp = fopen($destStreamURL . $file, "r");
header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($file)) . "; name=\"" . basename($file) . "\"");
header("Content-Length: " . $filesize);
header('Cache-Control: public');
$class = $streamData["classname"];
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
//exit(1);
}
}
}
开发者ID:firstcoder55,项目名称:Webkey,代码行数:48,代码来源:class.ImagePreviewer.php
示例10: stream_open
/**
* Opens the stream
* Diff with parent class : do not "securePath", as it removes double slash
*
* @param String $path Maybe in the form "ajxp.fs://repositoryId/pathToFile"
* @param String $mode
* @param unknown_type $options
* @param unknown_type $opened_path
* @return unknown
*/
public function stream_open($path, $mode, $options, &$context)
{
try {
$this->realPath = $this->initPath($path, "file");
} catch (Exception $e) {
AJXP_Logger::error(__CLASS__, "stream_open", "Error while opening stream {$path}");
return false;
}
if ($this->realPath == -1) {
$this->fp = -1;
return true;
} else {
$this->fp = fopen($this->realPath, $mode, $options, self::$cloudContext);
return $this->fp !== false;
}
}
开发者ID:biggtfish,项目名称:cms,代码行数:26,代码来源:class.hpcAccessWrapper.php
示例11: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (!self::$active) {
return false;
}
AJXP_Logger::debug("FlexProc is active=" . self::$active, $postProcessData);
$result = $postProcessData["processor_result"];
if (isset($result["SUCCESS"]) && $result["SUCCESS"] === true) {
header('HTTP/1.0 200 OK');
//die("200 OK");
} else {
if (isset($result["ERROR"]) && is_array($result["ERROR"])) {
$code = $result["ERROR"]["CODE"];
$message = $result["ERROR"]["MESSAGE"];
//header("HTTP/1.0 $code $message");
die("Error {$code} {$message}");
}
}
}
开发者ID:firstcoder55,项目名称:Webkey,代码行数:19,代码来源:class.FlexUploadProcessor.php
示例12: makeZip
function makeZip($src, $dest, $basedir)
{
@set_time_limit(0);
require_once AJXP_BIN_FOLDER . "/pclzip.lib.php";
$filePaths = array();
foreach ($src as $item) {
$realFile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $this->urlBase . "/" . AJXP_Utils::securePath($item));
$basedir = trim(dirname($realFile));
$filePaths[] = array(PCLZIP_ATT_FILE_NAME => $realFile, PCLZIP_ATT_FILE_NEW_SHORT_NAME => basename($item));
}
AJXP_Logger::debug("Pathes", $filePaths);
AJXP_Logger::debug("Basedir", array($basedir));
self::$filteringDriverInstance = $this;
$archive = new PclZip($dest);
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON);
if (!$vList) {
throw new Exception("Zip creation error : ({$dest}) " . $archive->errorInfo(true));
}
self::$filteringDriverInstance = null;
return $vList;
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:21,代码来源:class.smbAccessDriver.php
示例13: postProcess
public function postProcess($action, $httpVars, $params)
{
$url = $params["ob_output"];
if (!isset($this->pluginConf["BITLY_USER"]) || !isset($this->pluginConf["BITLY_APIKEY"])) {
print $url;
AJXP_Logger::logAction("error", "Bitly Shortener : you must drop the conf.shorten.bitly.inc file inside conf.php and set the login/api key!");
return;
}
$bitly_login = $this->pluginConf["BITLY_USER"];
$bitly_api = $this->pluginConf["BITLY_APIKEY"];
$format = 'json';
$version = '2.0.1';
$bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login=' . $bitly_login . '&apiKey=' . $bitly_api . '&format=' . $format;
$response = AJXP_Utils::getRemoteContent($bitly);
$json = json_decode($response, true);
if (isset($json['results'][$url]['shortUrl'])) {
print $json['results'][$url]['shortUrl'];
$this->updateMetaShort($httpVars["file"], $json['results'][$url]['shortUrl']);
} else {
print $url;
}
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:22,代码来源:class.BitlyShortener.php
示例14: init
public function init($options)
{
parent::init($options);
if (!extension_loaded("openssl")) {
return;
}
$keyFile = $this->getPluginWorkDir(true) . "/agent.pem";
if (file_exists($keyFile)) {
return;
}
$config = array("digest_alg" => "sha1", "private_key_bits" => 1024, "private_key_type" => OPENSSL_KEYTYPE_RSA);
// Create the private and public key
$res = openssl_pkey_new($config);
if ($res === false) {
AJXP_Logger::error(__CLASS__, __FUNCTION__, "Warning, OpenSSL is active but could not correctly generate a key for Zoho Editor. Please make sure the openssl.cnf file is correctly set up.");
while ($message = openssl_error_string()) {
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Open SSL Error: " . $message);
}
} else {
openssl_pkey_export_to_file($res, $keyFile);
}
}
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:22,代码来源:class.ZohoEditor.php
示例15: __construct
/** Construction. This kills the current session if any started, and restart the given session */
public function __construct($name, $cleanPreviousSession = false)
{
if (session_id() == "") {
// Mysterious fix, necessary for joomla.
ini_set('session.save_handler', 'files');
// Start a default session and save on the handler
session_start();
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
AJXP_Logger::debug("Session switching 1: ", SessionSwitcher::$sessionArray);
session_write_close();
} else {
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
}
// Please note that there is no start here, session might be already started
if (session_id() != "") {
// There was a previous session
if ($cleanPreviousSession) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
}
// Close the session
session_write_close();
session_regenerate_id(false);
$_SESSION = array();
// Need to generate a new session id
}
// Mysterious fix, necessary for joomla.
ini_set('session.save_handler', 'files');
$newId = md5(SessionSwitcher::$sessionArray[0]['id'] . $name);
AJXP_Logger::debug("Session switching new id: ", $newId);
session_id($newId);
session_name($name);
session_start();
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:37,代码来源:sessionSwitcher.php
示例16: listLogFiles
function listLogFiles($dir)
{
$logger = AJXP_Logger::getInstance();
$parts = explode("/", $dir);
if (count($parts) > 4) {
print '<columns switchDisplayMode="list" switchGridMode="grid">
<column messageString="Date" attributeName="date" sortType="Date" width="10%"/>
<column messageString="I.P." attributeName="ip" sortType="String"/>
<column messageString="Level" attributeName="level" sortType="String"/>
<column messageString="User" attributeName="user" sortType="String"/>
<column messageString="Action" attributeName="action" sortType="String"/>
<column messageString="Params" attributeName="params" sortType="String"/>
</columns>';
$date = $parts[count($parts) - 1];
$logger->xmlLogs($date, "tree");
} else {
print '<columns switchGridMode="filelist"><column messageString="File Date" attributeName="ajxp_label" sortType="String"/></columns>';
$logger->xmlListLogFiles("tree", count($parts) > 2 ? $parts[2] : null, count($parts) > 3 ? $parts[3] : null);
}
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:20,代码来源:class.ajxp_confAccessDriver.php
示例17: updateNodesIndex
/**
* @param AJXP_Node $oldNode
* @param AJXP_Node $newNode
* @param bool $copy
*/
public function updateNodesIndex($oldNode = null, $newNode = null, $copy = false)
{
if (!dibi::isConnected()) {
dibi::connect($this->sqlDriver);
}
//$this->logInfo("Syncable index", array($oldNode == null?'null':$oldNode->getUrl(), $newNode == null?'null':$newNode->getUrl()));
try {
if ($newNode != null && $this->excludeNode($newNode)) {
// CREATE
if ($oldNode == null) {
AJXP_Logger::debug("Ignoring " . $newNode->getUrl() . " for indexation");
return;
} else {
AJXP_Logger::debug("Target node is excluded, see it as a deletion: " . $newNode->getUrl());
$newNode = null;
}
}
if ($newNode == null) {
$repoId = $this->computeIdentifier($oldNode->getRepository(), $oldNode->getUser());
// DELETE
$this->logDebug('DELETE', $oldNode->getUrl());
dibi::query("DELETE FROM [ajxp_index] WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
} else {
if ($oldNode == null || $copy) {
// CREATE
$stat = stat($newNode->getUrl());
$newNode->setLeaf(!($stat['mode'] & 040000));
$this->logDebug('INSERT', $newNode->getUrl());
dibi::query("INSERT INTO [ajxp_index]", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath()), "bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => $newNode->isLeaf() ? md5_file($newNode->getUrl()) : "directory", "repository_identifier" => $repoId = $this->computeIdentifier($newNode->getRepository(), $newNode->getUser())));
} else {
$repoId = $this->computeIdentifier($oldNode->getRepository(), $oldNode->getUser());
if ($oldNode->getPath() == $newNode->getPath()) {
// CONTENT CHANGE
clearstatcache();
$stat = stat($newNode->getUrl());
$this->logDebug("Content changed", "current stat size is : " . $stat["size"]);
$this->logDebug('UPDATE CONTENT', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET ", array("bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => md5_file($newNode->getUrl())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
$this->updateNodesIndex(null, $newNode, false);
}
} catch (Exception $e) {
}
} else {
// PATH CHANGE ONLY
$newNode->loadNodeInfo();
if ($newNode->isLeaf()) {
$this->logDebug('UPDATE LEAF PATH', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET ", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
$this->updateNodesIndex(null, $newNode, false);
}
} catch (Exception $e) {
}
} else {
$this->logDebug('UPDATE FOLDER PATH', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET [node_path]=REPLACE( REPLACE(CONCAT('\$\$\$',[node_path]), CONCAT('\$\$\$', %s), CONCAT('\$\$\$', %s)) , '\$\$\$', '') ", $oldNode->getPath(), $newNode->getPath(), "WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed folder (" . $newNode->getPath() . "), relaunching a recursive indexation!");
AJXP_Controller::findActionAndApply("index", array("file" => $newNode->getPath()), array());
}
} catch (Exception $e) {
}
}
}
}
}
} catch (Exception $e) {
AJXP_Logger::error("[meta.syncable]", "Exception", $e->getTraceAsString());
AJXP_Logger::error("[meta.syncable]", "Indexation", $e->getMessage());
}
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:85,代码来源:class.ChangesTracker.php
示例18: saveTemporaryData
/**
* Save Temporary Data.
* Implementation uses serialised files because of the overhead incurred with a full db implementation.
*
* @param $key String key of data to save.
* @param $value Value to save
*/
public function saveTemporaryData($key, $value)
{
$dirPath = $this->storage->getOption("USERS_DIRPATH");
if ($dirPath == "") {
$dirPath = AJXP_INSTALL_PATH . "/data/users";
AJXP_Logger::info(__CLASS__, "setTemporaryData", array("Warning" => "The conf.sql driver is missing a mandatory option USERS_DIRPATH!"));
}
$id = AuthService::ignoreUserCase() ? strtolower($this->getId()) : $this->getId();
AJXP_Utils::saveSerialFile($dirPath . "/" . $id . "/temp-" . $key . ".ser", $value);
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:17,代码来源:class.AJXP_SqlUser.php
示例19: upgradeDB
public function upgradeDB()
{
$confDriver = ConfService::getConfStorageImpl();
$authDriver = ConfService::getAuthDriverImpl();
$logger = AJXP_Logger::getInstance();
if (is_a($confDriver, "sqlConfDriver")) {
$conf = AJXP_Utils::cleanDibiDriverParameters($confDriver->getOption("SQL_DRIVER"));
if (!is_array($conf) || !isset($conf["driver"])) {
return "Nothing to do";
}
switch ($conf["driver"]) {
case "sqlite":
case "sqlite3":
$ext = ".sqlite";
break;
case "postgre":
$ext = ".pgsql";
break;
case "mysql":
$ext = is_file($this->workingFolder . "/" . $this->dbUpgrade . ".mysql") ? ".mysql" : ".sql";
break;
default:
return "ERROR!, DB driver " . $conf["driver"] . " not supported yet in __FUNCTION__";
}
$file = $this->dbUpgrade . $ext;
if (!is_file($this->workingFolder . "/" . $file)) {
return "Nothing to do.";
}
$sqlInstructions = file_get_contents($this->workingFolder . "/" . $file);
$parts = array_map("trim", explode("/* SEPARATOR */", $sqlInstructions));
$results = array();
$errors = array();
dibi::connect($conf);
dibi::begin();
foreach ($parts as $sqlPart) {
if (empty($sqlPart)) {
continue;
}
try {
dibi::nativeQuery($sqlPart);
$results[] = $sqlPart;
} catch (DibiException $e) {
$errors[] = $sqlPart . " (" . $e->getMessage() . ")";
}
}
dibi::commit();
dibi::disconnect();
if (!count($errors)) {
return "Database successfully upgraded";
} else {
return "Database upgrade failed. <br>The following statements were executed : <br>" . implode("<br>", $results) . ",<br><br> The following statements failed : <br>" . implode("<br>", $errors) . "<br><br> You should manually upgrade your DB.";
}
}
}
开发者ID:Nanomani,项目名称:pydio-core,代码行数:54,代码来源:class.AjaXplorerUpgrader.php
示例20: createFTPLink
protected function createFTPLink()
{
// If connexion exist and is still connected
if (is_array($_SESSION["FTP_CONNEXIONS"]) && array_key_exists($this->repositoryId, $_SESSION["FTP_CONNEXIONS"]) && @ftp_systype($_SESSION["FTP_CONNEXIONS"][$this->repositoryId])) {
AJXP_Logger::debug("Using stored FTP Session");
retu
|
请发表评论