/** * @param string $subject * @param boolean $exclusiveLock TRUE to, acquire an exclusive (write) lock, FALSE for a shared (read) lock. An exclusive lock ist the default. */ public function __construct($subject, $exclusiveLock = true) { if (self::$lockManager === null) { return; } $this->lockStrategy = self::$lockManager->getLockStrategyInstance(); $this->lockStrategy->acquire($subject, $exclusiveLock); }
/** * Release the locks when this goes out of scope */ function __destruct() { $wasOk = $this->status->isOK(); $this->status->merge( $this->manager->unlockByType( $this->pathsByType ) ); if ( $wasOk ) { // Make sure status is OK, despite any unlockFiles() fatals $this->status->setResult( true, $this->status->value ); } }
/** * Unlock the files at the given storage paths in the backend. * * @param array $paths Storage paths * @param integer $type LockManager::LOCK_* constant * @return Status */ final public function unlockFiles( array $paths, $type ) { $paths = array_map( 'FileBackend::normalizeStoragePath', $paths ); return $this->lockManager->unlock( $paths, $type ); }
/** * Construct a new instance from configuration. * * $config includes: * - lockDirectory : Directory containing the lock files * * @param array $config */ function __construct(array $config) { parent::__construct($config); $this->lockDir = $config['lockDirectory']; }
case "preview": if (!isset($content)) { $content = ''; } $tool_content .= claro_disp_wiki_preview($wikiRenderer, $wiki_title, $content); $tool_content .= claro_disp_wiki_preview_buttons($wikiId, $wiki_title, $content, $changelog); break; // view page // view page case "show": if ($wikiPage->hasError()) { $tool_content .= $wikiPage->getError(); } else { //unlock after edit cancellation //only if current user is the lock owner (to avoid unlocking with GET) $lock_manager = new LockManager(); if ($lock_manager->getLockOwner($wiki_title, $wikiId) == $uid) { $lock_manager->releaseLock($wiki_title, $wikiId); } // get localized value for wiki main page title if ($wiki_title === '__MainPage__') { //$displaytitle = $langWikiMainPage; $displaytitle = ''; } else { //$displaytitle = $wiki_title; $displaytitle = ''; } if ($versionId != 0) { $editorInfo = user_get_data($wikiPage->getEditorId()); $editorStr = q($editorInfo->givenname) . " " . q($editorInfo->username); $editorUrl = ' - ' . $editorStr;
/** * Unlock the files at the given storage paths in the backend. * * @param $paths Array Storage paths * @param $type integer LockManager::LOCK_* constant * @return Status */ public final function unlockFiles(array $paths, $type) { return $this->lockManager->unlock($paths, $type); }
/** * @param $path string * @return string */ protected function recordKeyForPath($path) { $hash = LockManager::sha1Base36($path); list($db, $prefix) = wfSplitWikiID($this->wikiId); return wfForeignMemcKey($db, $prefix, __CLASS__, 'locks', $hash); }
/** * Construct a new instance from configuration. * * @param array $config Includes: * - lockDirectory : Directory containing the lock files */ function __construct(array $config) { parent::__construct($config); $this->lockDir = $config['lockDirectory']; $this->isWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; }
* For a full list of contributors, see "credits.txt". * * Open eClass is an open platform distributed in the hope that it will * be useful (without any warranty), under the terms of the GNU (General * Public License) as published by the Free Software Foundation. * The full license can be read in "/info/license/license_gpl.txt". * * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $img = file_get_contents("dot.png"); require_once '../../../include/baseTheme.php'; require_once 'class.lockmanager.php'; $page_title = strip_tags(rawurldecode($_REQUEST['page_title'])); $userid = intval($_REQUEST['uid']); $wikiId = intval($_REQUEST['wiki_id']); //prevent other users to execute this code if ($uid != 0 && $userid == $uid) { $lock_manager = new LockManager(); $lock_manager->nojslock($page_title, $wikiId, $userid); } header('Content-Type: image/png'); echo $img;
* Open eClass 3.0 * E-learning and Course Management System * ======================================================================== * Copyright 2003-2012 Greek Universities Network - GUnet * A full copyright notice can be read in "/info/copyright.txt". * For a full list of contributors, see "credits.txt". * * Open eClass is an open platform distributed in the hope that it will * be useful (without any warranty), under the terms of the GNU (General * Public License) as published by the Free Software Foundation. * The full license can be read in "/info/license/license_gpl.txt". * * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ require_once '../../../include/baseTheme.php'; require_once 'class.lockmanager.php'; $page_title = strip_tags(rawurldecode($_REQUEST['page_title'])); $userid = intval($_REQUEST['uid']); $wikiId = intval($_REQUEST['wiki_id']); if ($uid != 0 && $userid == $uid) { $lock_manager = new LockManager(); $lock_manager->alive($page_title, $wikiId, $userid); }