MediaWiki  1.23.2
CdbDBA.php
Go to the documentation of this file.
1 <?php
26 class CdbReaderDBA extends CdbReader {
27  public function __construct( $fileName ) {
28  $this->handle = dba_open( $fileName, 'r-', 'cdb' );
29  if ( !$this->handle ) {
30  throw new CdbException( 'Unable to open CDB file "' . $fileName . '"' );
31  }
32  }
33 
34  public function close() {
35  if ( isset( $this->handle ) ) {
36  dba_close( $this->handle );
37  }
38  unset( $this->handle );
39  }
40 
41  public function get( $key ) {
42  return dba_fetch( $key, $this->handle );
43  }
44 }
45 
49 class CdbWriterDBA extends CdbWriter {
50  public function __construct( $fileName ) {
51  $this->realFileName = $fileName;
52  $this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff );
53  $this->handle = dba_open( $this->tmpFileName, 'n', 'cdb_make' );
54  if ( !$this->handle ) {
55  throw new CdbException( 'Unable to open CDB file for write "' . $fileName . '"' );
56  }
57  }
58 
59  public function set( $key, $value ) {
60  return dba_insert( $key, $value, $this->handle );
61  }
62 
63  public function close() {
64  if ( isset( $this->handle ) ) {
65  dba_close( $this->handle );
66  }
67  if ( $this->isWindows() ) {
68  unlink( $this->realFileName );
69  }
70  if ( !rename( $this->tmpFileName, $this->realFileName ) ) {
71  throw new CdbException( 'Unable to move the new CDB file into place.' );
72  }
73  unset( $this->handle );
74  }
75 }
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
CdbWriterDBA\__construct
__construct( $fileName)
Create the object and open the file.
Definition: CdbDBA.php:50
CdbWriterDBA\close
close()
Close the writer object.
Definition: CdbDBA.php:63
CdbReaderDBA\__construct
__construct( $fileName)
Create the object and open the file.
Definition: CdbDBA.php:27
$value
$value
Definition: styleTest.css.php:45
CdbReaderDBA
Reader class which uses the DBA extension.
Definition: CdbDBA.php:26
CdbWriter\isWindows
isWindows()
Are we running on Windows?
Definition: Cdb.php:150
CdbReader
Read from a CDB file.
Definition: Cdb.php:28
CdbException
Exception for Cdb errors.
Definition: Cdb.php:159
CdbWriter
Write to a CDB file.
Definition: Cdb.php:88
CdbReaderDBA\close
close()
Close the file.
Definition: CdbDBA.php:34