Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
locking_method.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset.inc';
18 
19 
41 class Locking_Method extends Asset
42 {
43 
44 
54  public function __construct($assetid=0)
55  {
56  parent::__construct($assetid);
57 
58  }//end __construct()
59 
60 
87  public static function acquireLock($lockid, $source_lockid='', $expires=0)
88  {
89  trigger_error('This locking method has not implemented acquiring of locks', E_USER_ERROR);
90 
91  }//end acquireLock()
92 
93 
114  public static function updateLock($lockid, $expires=0)
115  {
116  trigger_error('This locking method has not implemented updating of locks', E_USER_ERROR);
117 
118  }//end acquireLock()
119 
120 
133  public static function releaseLock($lockid)
134  {
135  trigger_error('This locking method has not implemented releasing of locks', E_USER_ERROR);
136 
137  }//end releaseLock()
138 
139 
159  public static function getLockInfo($lockid, $full_chain=FALSE, $check_expires=TRUE, $allow_only_one=TRUE)
160  {
161  trigger_error('This locking method has not implemented getting of lock info', E_USER_ERROR);
162 
163  }//end getLockInfo()
164 
165 
166 
167 
168 
185  public static function getActiveLocks($owner_assetid=NULL, $include_expired=FALSE)
186  {
187  if (self::supportsGetActiveLocks() === FALSE) {
188  trigger_error('This locking method does not support getting of active locks', E_USER_WARNING);
189  return FALSE;
190  } else {
191  trigger_error('This locking method supports getting of active locks, but has not implemented getActiveLocks method', E_USER_ERROR);
192  }
193 
194  }//end getActiveLocks()
195 
196 
202  public static function supportsGetActiveLocks()
203  {
204  return TRUE;
205 
206  }//end supportsGetActiveLocks()
207 
208 
223  public static function changeLockOwner($old_assetid, $new_assetid)
224  {
225  if (self::supportsGetActiveLocks() === FALSE) {
226  trigger_error('This locking method does not support changing of lock owner', E_USER_WARNING);
227  return FALSE;
228  } else {
229  trigger_error('This locking method supports changing of lock owner, but has not implemented changeLockOwner method', E_USER_ERROR);
230  }
231 
232  }//end changeLockOwner()
233 
234 
240  public static function supportsChangeLockOwner()
241  {
242  return TRUE;
243 
244  }//end supportsChangeLockOwner()
245 
246 
252  public static function supportsDeletingExpiredLocks()
253  {
254  return TRUE;
255 
256  }//end supportsDeletingExpiredLocks()
257 
258 
259 }//end class
260 
261 ?>