| Index: trunk/phase3/includes/DatabaseFunctions.php |
| — | — | @@ -1,412 +0,0 @@ |
| 2 | | -<?php |
| 3 | | -/** |
| 4 | | - * Legacy database functions, for compatibility with pre-1.3 code |
| 5 | | - * NOTE: this file is no longer loaded by default. |
| 6 | | - * @file |
| 7 | | - * @ingroup Database |
| 8 | | - */ |
| 9 | | - |
| 10 | | -/** |
| 11 | | - * Usually aborts on failure |
| 12 | | - * If errors are explicitly ignored, returns success |
| 13 | | - * @param $sql String: SQL query |
| 14 | | - * @param $db Mixed: database handler |
| 15 | | - * @param $fname String: name of the php function calling |
| 16 | | - */ |
| 17 | | -function wfQuery( $sql, $db, $fname = '' ) { |
| 18 | | - if ( !is_numeric( $db ) ) { |
| 19 | | - # Someone has tried to call this the old way |
| 20 | | - throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) ); |
| 21 | | - } |
| 22 | | - $c = wfGetDB( $db ); |
| 23 | | - if ( $c !== false ) { |
| 24 | | - return $c->query( $sql, $fname ); |
| 25 | | - } else { |
| 26 | | - return false; |
| 27 | | - } |
| 28 | | -} |
| 29 | | - |
| 30 | | -/** |
| 31 | | - * |
| 32 | | - * @param $sql String: SQL query |
| 33 | | - * @param $dbi |
| 34 | | - * @param $fname String: name of the php function calling |
| 35 | | - * @return Array: first row from the database |
| 36 | | - */ |
| 37 | | -function wfSingleQuery( $sql, $dbi, $fname = '' ) { |
| 38 | | - $db = wfGetDB( $dbi ); |
| 39 | | - $res = $db->query($sql, $fname ); |
| 40 | | - $row = $db->fetchRow( $res ); |
| 41 | | - $ret = $row[0]; |
| 42 | | - $db->freeResult( $res ); |
| 43 | | - return $ret; |
| 44 | | -} |
| 45 | | - |
| 46 | | -/** |
| 47 | | - * Turns on (false) or off (true) the automatic generation and sending |
| 48 | | - * of a "we're sorry, but there has been a database error" page on |
| 49 | | - * database errors. Default is on (false). When turned off, the |
| 50 | | - * code should use wfLastErrno() and wfLastError() to handle the |
| 51 | | - * situation as appropriate. |
| 52 | | - * |
| 53 | | - * @param $newstate |
| 54 | | - * @param $dbi |
| 55 | | - * @return Returns the previous state. |
| 56 | | - */ |
| 57 | | -function wfIgnoreSQLErrors( $newstate, $dbi = DB_LAST ) { |
| 58 | | - $db = wfGetDB( $dbi ); |
| 59 | | - if ( $db !== false ) { |
| 60 | | - return $db->ignoreErrors( $newstate ); |
| 61 | | - } else { |
| 62 | | - return null; |
| 63 | | - } |
| 64 | | -} |
| 65 | | - |
| 66 | | -/**#@+ |
| 67 | | - * @param $res Database result handler |
| 68 | | - * @param $dbi |
| 69 | | -*/ |
| 70 | | - |
| 71 | | -/** |
| 72 | | - * Free a database result |
| 73 | | - * @return Bool: whether result is sucessful or not. |
| 74 | | - */ |
| 75 | | -function wfFreeResult( $res, $dbi = DB_LAST ) |
| 76 | | -{ |
| 77 | | - $db = wfGetDB( $dbi ); |
| 78 | | - if ( $db !== false ) { |
| 79 | | - $db->freeResult( $res ); |
| 80 | | - return true; |
| 81 | | - } else { |
| 82 | | - return false; |
| 83 | | - } |
| 84 | | -} |
| 85 | | - |
| 86 | | -/** |
| 87 | | - * Get an object from a database result |
| 88 | | - * @return object|false object we requested |
| 89 | | - */ |
| 90 | | -function wfFetchObject( $res, $dbi = DB_LAST ) { |
| 91 | | - $db = wfGetDB( $dbi ); |
| 92 | | - if ( $db !== false ) { |
| 93 | | - return $db->fetchObject( $res, $dbi = DB_LAST ); |
| 94 | | - } else { |
| 95 | | - return false; |
| 96 | | - } |
| 97 | | -} |
| 98 | | - |
| 99 | | -/** |
| 100 | | - * Get a row from a database result |
| 101 | | - * @return object|false row we requested |
| 102 | | - */ |
| 103 | | -function wfFetchRow( $res, $dbi = DB_LAST ) { |
| 104 | | - $db = wfGetDB( $dbi ); |
| 105 | | - if ( $db !== false ) { |
| 106 | | - return $db->fetchRow ( $res, $dbi = DB_LAST ); |
| 107 | | - } else { |
| 108 | | - return false; |
| 109 | | - } |
| 110 | | -} |
| 111 | | - |
| 112 | | -/** |
| 113 | | - * Get a number of rows from a database result |
| 114 | | - * @return integer|false number of rows |
| 115 | | - */ |
| 116 | | -function wfNumRows( $res, $dbi = DB_LAST ) { |
| 117 | | - $db = wfGetDB( $dbi ); |
| 118 | | - if ( $db !== false ) { |
| 119 | | - return $db->numRows( $res, $dbi = DB_LAST ); |
| 120 | | - } else { |
| 121 | | - return false; |
| 122 | | - } |
| 123 | | -} |
| 124 | | - |
| 125 | | -/** |
| 126 | | - * Get the number of fields from a database result |
| 127 | | - * @return integer|false number of fields |
| 128 | | - */ |
| 129 | | -function wfNumFields( $res, $dbi = DB_LAST ) { |
| 130 | | - $db = wfGetDB( $dbi ); |
| 131 | | - if ( $db !== false ) { |
| 132 | | - return $db->numFields( $res ); |
| 133 | | - } else { |
| 134 | | - return false; |
| 135 | | - } |
| 136 | | -} |
| 137 | | - |
| 138 | | -/** |
| 139 | | - * Return name of a field in a result |
| 140 | | - * @param $res Mixed: Ressource link see Database::fieldName() |
| 141 | | - * @param $n Integer: id of the field |
| 142 | | - * @param $dbi Default DB_LAST |
| 143 | | - * @return string|false name of field |
| 144 | | - */ |
| 145 | | -function wfFieldName( $res, $n, $dbi = DB_LAST ) |
| 146 | | -{ |
| 147 | | - $db = wfGetDB( $dbi ); |
| 148 | | - if ( $db !== false ) { |
| 149 | | - return $db->fieldName( $res, $n, $dbi = DB_LAST ); |
| 150 | | - } else { |
| 151 | | - return false; |
| 152 | | - } |
| 153 | | -} |
| 154 | | -/**#@-*/ |
| 155 | | - |
| 156 | | -/** |
| 157 | | - * @todo document function |
| 158 | | - * @see Database::insertId() |
| 159 | | - */ |
| 160 | | -function wfInsertId( $dbi = DB_LAST ) { |
| 161 | | - $db = wfGetDB( $dbi ); |
| 162 | | - if ( $db !== false ) { |
| 163 | | - return $db->insertId(); |
| 164 | | - } else { |
| 165 | | - return false; |
| 166 | | - } |
| 167 | | -} |
| 168 | | - |
| 169 | | -/** |
| 170 | | - * @todo document function |
| 171 | | - * @see Database::dataSeek() |
| 172 | | - */ |
| 173 | | -function wfDataSeek( $res, $row, $dbi = DB_LAST ) { |
| 174 | | - $db = wfGetDB( $dbi ); |
| 175 | | - if ( $db !== false ) { |
| 176 | | - return $db->dataSeek( $res, $row ); |
| 177 | | - } else { |
| 178 | | - return false; |
| 179 | | - } |
| 180 | | -} |
| 181 | | - |
| 182 | | -/** |
| 183 | | - * Get the last error number |
| 184 | | - * @see Database::lastErrno() |
| 185 | | - */ |
| 186 | | -function wfLastErrno( $dbi = DB_LAST ) { |
| 187 | | - $db = wfGetDB( $dbi ); |
| 188 | | - if ( $db !== false ) { |
| 189 | | - return $db->lastErrno(); |
| 190 | | - } else { |
| 191 | | - return false; |
| 192 | | - } |
| 193 | | -} |
| 194 | | - |
| 195 | | -/** |
| 196 | | - * Get the last error |
| 197 | | - * @see Database::lastError() |
| 198 | | - */ |
| 199 | | -function wfLastError( $dbi = DB_LAST ) { |
| 200 | | - $db = wfGetDB( $dbi ); |
| 201 | | - if ( $db !== false ) { |
| 202 | | - return $db->lastError(); |
| 203 | | - } else { |
| 204 | | - return false; |
| 205 | | - } |
| 206 | | -} |
| 207 | | - |
| 208 | | -/** |
| 209 | | - * Get the number of affected rows |
| 210 | | - * @see Database::affectedRows() |
| 211 | | - */ |
| 212 | | -function wfAffectedRows( $dbi = DB_LAST ) { |
| 213 | | - $db = wfGetDB( $dbi ); |
| 214 | | - if ( $db !== false ) { |
| 215 | | - return $db->affectedRows(); |
| 216 | | - } else { |
| 217 | | - return false; |
| 218 | | - } |
| 219 | | -} |
| 220 | | - |
| 221 | | -/** |
| 222 | | - * Get the last query ran |
| 223 | | - * @see Database::lastQuery |
| 224 | | - */ |
| 225 | | -function wfLastDBquery( $dbi = DB_LAST ) { |
| 226 | | - $db = wfGetDB( $dbi ); |
| 227 | | - if ( $db !== false ) { |
| 228 | | - return $db->lastQuery(); |
| 229 | | - } else { |
| 230 | | - return false; |
| 231 | | - } |
| 232 | | -} |
| 233 | | - |
| 234 | | -/** |
| 235 | | - * @see Database::Set() |
| 236 | | - * @todo document function |
| 237 | | - * @param $table |
| 238 | | - * @param $var |
| 239 | | - * @param $value |
| 240 | | - * @param $cond |
| 241 | | - * @param $dbi Default DB_MASTER |
| 242 | | - */ |
| 243 | | -function wfSetSQL( $table, $var, $value, $cond, $dbi = DB_MASTER ) |
| 244 | | -{ |
| 245 | | - $db = wfGetDB( $dbi ); |
| 246 | | - if ( $db !== false ) { |
| 247 | | - return $db->set( $table, $var, $value, $cond ); |
| 248 | | - } else { |
| 249 | | - return false; |
| 250 | | - } |
| 251 | | -} |
| 252 | | - |
| 253 | | - |
| 254 | | -/** |
| 255 | | - * Simple select wrapper, return one field |
| 256 | | - * @see Database::selectField() |
| 257 | | - * @param $table |
| 258 | | - * @param $var |
| 259 | | - * @param $cond Default '' |
| 260 | | - * @param $dbi Default DB_LAST |
| 261 | | - */ |
| 262 | | -function wfGetSQL( $table, $var, $cond='', $dbi = DB_LAST ) |
| 263 | | -{ |
| 264 | | - $db = wfGetDB( $dbi ); |
| 265 | | - if ( $db !== false ) { |
| 266 | | - return $db->selectField( $table, $var, $cond ); |
| 267 | | - } else { |
| 268 | | - return false; |
| 269 | | - } |
| 270 | | -} |
| 271 | | - |
| 272 | | -/** |
| 273 | | - * Does a given field exist on the specified table? |
| 274 | | - * @see Database::fieldExists() |
| 275 | | - * @param $table |
| 276 | | - * @param $field |
| 277 | | - * @param $dbi Default DB_LAST |
| 278 | | - * @return Result of Database::fieldExists() or false. |
| 279 | | - */ |
| 280 | | -function wfFieldExists( $table, $field, $dbi = DB_LAST ) { |
| 281 | | - $db = wfGetDB( $dbi ); |
| 282 | | - if ( $db !== false ) { |
| 283 | | - return $db->fieldExists( $table, $field ); |
| 284 | | - } else { |
| 285 | | - return false; |
| 286 | | - } |
| 287 | | -} |
| 288 | | - |
| 289 | | -/** |
| 290 | | - * Does the requested index exist on the specified table? |
| 291 | | - * @see Database::indexExists() |
| 292 | | - * @param $table String |
| 293 | | - * @param $index |
| 294 | | - * @param $dbi Default DB_LAST |
| 295 | | - * @return Result of Database::indexExists() or false. |
| 296 | | - */ |
| 297 | | -function wfIndexExists( $table, $index, $dbi = DB_LAST ) { |
| 298 | | - $db = wfGetDB( $dbi ); |
| 299 | | - if ( $db !== false ) { |
| 300 | | - return $db->indexExists( $table, $index ); |
| 301 | | - } else { |
| 302 | | - return false; |
| 303 | | - } |
| 304 | | -} |
| 305 | | - |
| 306 | | -/** |
| 307 | | - * @see Database::insert() |
| 308 | | - * @todo document function |
| 309 | | - * @param $table String |
| 310 | | - * @param $array Array |
| 311 | | - * @param $fname String, default 'wfInsertArray'. |
| 312 | | - * @param $dbi Default DB_MASTER |
| 313 | | - * @return result of Database::insert() or false. |
| 314 | | - */ |
| 315 | | -function wfInsertArray( $table, $array, $fname = 'wfInsertArray', $dbi = DB_MASTER ) { |
| 316 | | - $db = wfGetDB( $dbi ); |
| 317 | | - if ( $db !== false ) { |
| 318 | | - return $db->insert( $table, $array, $fname ); |
| 319 | | - } else { |
| 320 | | - return false; |
| 321 | | - } |
| 322 | | -} |
| 323 | | - |
| 324 | | -/** |
| 325 | | - * @see Database::getArray() |
| 326 | | - * @todo document function |
| 327 | | - * @param $table String |
| 328 | | - * @param $vars |
| 329 | | - * @param $conds |
| 330 | | - * @param $fname String, default 'wfGetArray'. |
| 331 | | - * @param $dbi Default DB_LAST |
| 332 | | - * @return result of Database::getArray() or false. |
| 333 | | - */ |
| 334 | | -function wfGetArray( $table, $vars, $conds, $fname = 'wfGetArray', $dbi = DB_LAST ) { |
| 335 | | - $db = wfGetDB( $dbi ); |
| 336 | | - if ( $db !== false ) { |
| 337 | | - return $db->getArray( $table, $vars, $conds, $fname ); |
| 338 | | - } else { |
| 339 | | - return false; |
| 340 | | - } |
| 341 | | -} |
| 342 | | - |
| 343 | | -/** |
| 344 | | - * @see Database::update() |
| 345 | | - * @param $table String |
| 346 | | - * @param $values |
| 347 | | - * @param $conds |
| 348 | | - * @param $fname String, default 'wfUpdateArray' |
| 349 | | - * @param $dbi Default DB_MASTER |
| 350 | | - * @return Result of Database::update()) or false; |
| 351 | | - * @todo document function |
| 352 | | - */ |
| 353 | | -function wfUpdateArray( $table, $values, $conds, $fname = 'wfUpdateArray', $dbi = DB_MASTER ) { |
| 354 | | - $db = wfGetDB( $dbi ); |
| 355 | | - if ( $db !== false ) { |
| 356 | | - $db->update( $table, $values, $conds, $fname ); |
| 357 | | - return true; |
| 358 | | - } else { |
| 359 | | - return false; |
| 360 | | - } |
| 361 | | -} |
| 362 | | - |
| 363 | | -/** |
| 364 | | - * Get fully usable table name |
| 365 | | - * @see Database::tableName() |
| 366 | | - */ |
| 367 | | -function wfTableName( $name, $dbi = DB_LAST ) { |
| 368 | | - $db = wfGetDB( $dbi ); |
| 369 | | - if ( $db !== false ) { |
| 370 | | - return $db->tableName( $name ); |
| 371 | | - } else { |
| 372 | | - return false; |
| 373 | | - } |
| 374 | | -} |
| 375 | | - |
| 376 | | -/** |
| 377 | | - * @todo document function |
| 378 | | - * @see Database::strencode() |
| 379 | | - */ |
| 380 | | -function wfStrencode( $s, $dbi = DB_LAST ) { |
| 381 | | - $db = wfGetDB( $dbi ); |
| 382 | | - if ( $db !== false ) { |
| 383 | | - return $db->strencode( $s ); |
| 384 | | - } else { |
| 385 | | - return false; |
| 386 | | - } |
| 387 | | -} |
| 388 | | - |
| 389 | | -/** |
| 390 | | - * @todo document function |
| 391 | | - * @see Database::nextSequenceValue() |
| 392 | | - */ |
| 393 | | -function wfNextSequenceValue( $seqName, $dbi = DB_MASTER ) { |
| 394 | | - $db = wfGetDB( $dbi ); |
| 395 | | - if ( $db !== false ) { |
| 396 | | - return $db->nextSequenceValue( $seqName ); |
| 397 | | - } else { |
| 398 | | - return false; |
| 399 | | - } |
| 400 | | -} |
| 401 | | - |
| 402 | | -/** |
| 403 | | - * @todo document function |
| 404 | | - * @see Database::useIndexClause() |
| 405 | | - */ |
| 406 | | -function wfUseIndexClause( $index, $dbi = DB_SLAVE ) { |
| 407 | | - $db = wfGetDB( $dbi ); |
| 408 | | - if ( $db !== false ) { |
| 409 | | - return $db->useIndexClause( $index ); |
| 410 | | - } else { |
| 411 | | - return false; |
| 412 | | - } |
| 413 | | -} |
| Index: trunk/phase3/includes/HTMLFileCache.php |
| — | — | @@ -7,8 +7,7 @@ |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles talking to the file cache, putting stuff in and taking it back out. |
| 11 | | - * Mostly called from Article.php, also from DatabaseFunctions.php for the |
| 12 | | - * emergency abort/fallback to cache. |
| | 11 | + * Mostly called from Article.php for the emergency abort/fallback to cache. |
| 13 | 12 | * |
| 14 | 13 | * Global options that affect this module: |
| 15 | 14 | * - $wgCachePages |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -22,6 +22,8 @@ |
| 23 | 23 | * (bug 12797) Allow adjusting of default gallery display options: |
| 24 | 24 | $wgGalleryImagesPerRow, $wgGalleryImageWidth, $wgGalleryImageHeight |
| 25 | 25 | $wgGalleryCaptionLength, $wgGalleryShowBytes |
| | 26 | +* DatabaseFunctions.php that was needed for compatibility with pre-1.3 extensions |
| | 27 | + has been removed. |
| 26 | 28 | |
| 27 | 29 | === New features in 1.17 === |
| 28 | 30 | |