| 1 | <?php |
| 2 | /** |
| 3 | * Efficient concatenated text storage. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | * http://www.gnu.org/copyleft/gpl.html |
| 19 | * |
| 20 | * @file |
| 21 | */ |
| 22 | |
| 23 | /** |
| 24 | * Base class for general text storage via the "object" flag in old_flags, or |
| 25 | * two-part external storage URLs. Used for represent efficient concatenated |
| 26 | * storage, and migration-related pointer objects. |
| 27 | */ |
| 28 | interface HistoryBlob { |
| 29 | /** |
| 30 | * Adds an item of text, returns a stub object which points to the item. |
| 31 | * You must call setLocation() on the stub object before storing it to the |
| 32 | * database |
| 33 | * |
| 34 | * @param string $text |
| 35 | * |
| 36 | * @return string The key for getItem() |
| 37 | */ |
| 38 | public function addItem( $text ); |
| 39 | |
| 40 | /** |
| 41 | * Get item by key, or false if the key is not present |
| 42 | * |
| 43 | * @param string $key |
| 44 | * |
| 45 | * @return string|bool |
| 46 | */ |
| 47 | public function getItem( $key ); |
| 48 | |
| 49 | /** |
| 50 | * Set the "default text" |
| 51 | * This concept is an odd property of the current DB schema, whereby each text item has a revision |
| 52 | * associated with it. The default text is the text of the associated revision. There may, however, |
| 53 | * be other revisions in the same object. |
| 54 | * |
| 55 | * Default text is not required for two-part external storage URLs. |
| 56 | * |
| 57 | * @param string $text |
| 58 | */ |
| 59 | public function setText( $text ); |
| 60 | |
| 61 | /** |
| 62 | * Get default text. |
| 63 | * |
| 64 | * @return string|false |
| 65 | */ |
| 66 | public function getText(); |
| 67 | } |