MediaWiki  1.23.0
Cdb.php
Go to the documentation of this file.
1 <?php
28 abstract class CdbReader {
32  protected $handle;
33 
41  public static function open( $fileName ) {
42  return self::haveExtension() ?
43  new CdbReaderDBA( $fileName ) :
44  new CdbReaderPHP( $fileName );
45  }
46 
52  public static function haveExtension() {
53  if ( !function_exists( 'dba_handlers' ) ) {
54  return false;
55  }
56  $handlers = dba_handlers();
57  if ( !in_array( 'cdb', $handlers ) || !in_array( 'cdb_make', $handlers ) ) {
58  return false;
59  }
60 
61  return true;
62  }
63 
69  abstract public function __construct( $fileName );
70 
74  abstract public function close();
75 
81  abstract public function get( $key );
82 }
83 
88 abstract class CdbWriter {
92  protected $handle;
93 
98  protected $realFileName;
99 
104  protected $tmpFileName;
105 
114  public static function open( $fileName ) {
115  return CdbReader::haveExtension() ?
116  new CdbWriterDBA( $fileName ) :
117  new CdbWriterPHP( $fileName );
118  }
119 
125  abstract public function __construct( $fileName );
126 
132  abstract public function set( $key, $value );
133 
138  abstract public function close();
139 
143  public function __destruct() {
144  if ( isset( $this->handle ) ) {
145  $this->close();
146  }
147  }
148 
152  protected function isWindows() {
153  return substr( php_uname(), 0, 7 ) == 'Windows';
154  }
155 }
156 
161 class CdbException extends Exception {}
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
CdbWriterDBA
Writer class which uses the DBA extension.
Definition: CdbDBA.php:49
CdbReader\close
close()
Close the file.
CdbWriter\__construct
__construct( $fileName)
Create the object and open the file.
CdbReader\__construct
__construct( $fileName)
Create the object and open the file.
CdbReader\haveExtension
static haveExtension()
Returns true if the native extension is available.
Definition: Cdb.php:52
CdbReader\$handle
$handle
The file handle.
Definition: Cdb.php:32
CdbWriter\open
static open( $fileName)
Open a writer and return a subclass instance.
Definition: Cdb.php:112
CdbWriter\close
close()
Close the writer object.
CdbWriterPHP
CDB writer class.
Definition: CdbPHP.php:290
$value
$value
Definition: styleTest.css.php:45
CdbWriter\$handle
$handle
The file handle.
Definition: Cdb.php:92
CdbWriter\$tmpFileName
string $tmpFileName
File we write to temporarily until we're done.
Definition: Cdb.php:102
CdbReaderDBA
Reader class which uses the DBA extension.
Definition: CdbDBA.php:26
CdbWriter\isWindows
isWindows()
Are we running on Windows?
Definition: Cdb.php:150
CdbReaderPHP
CDB reader class.
Definition: CdbPHP.php:102
CdbReader
Read from a CDB file.
Definition: Cdb.php:28
CdbReader\open
static open( $fileName)
Open a file and return a subclass instance.
Definition: Cdb.php:41
CdbException
Exception for Cdb errors.
Definition: Cdb.php:159
CdbWriter
Write to a CDB file.
Definition: Cdb.php:88
CdbWriter\$realFileName
string $realFileName
File we'll be writing to when we're done.
Definition: Cdb.php:97
CdbWriter\__destruct
__destruct()
If the object goes out of scope, close it for sanity.
Definition: Cdb.php:141