Changeset 47733 for trunk/src/wp-includes/SimplePie/Cache/MySQL.php
- Timestamp:
- 05/01/2020 02:24:42 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/SimplePie/Cache/MySQL.php
r22798 r47733 6 6 * Takes the hard work out of managing a complete RSS/Atom solution. 7 7 * 8 * Copyright (c) 2004-201 2, Ryan Parman, GeoffreySneddon, Ryan McCue, and contributors8 * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors 9 9 * All rights reserved. 10 10 * … … 34 34 * 35 35 * @package SimplePie 36 * @version 1.3.1 37 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue 36 * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue 38 37 * @author Ryan Parman 39 * @author GeoffreySneddon38 * @author Sam Sneddon 40 39 * @author Ryan McCue 41 40 * @link http://simplepie.org/ SimplePie … … 95 94 'extras' => array( 96 95 'prefix' => '', 96 'cache_purge_time' => 2592000 97 97 ), 98 98 ); 99 $this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); 99 100 $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); 100 101 101 102 // Path is prefixed with a "/" … … 131 132 if ($query === false) 132 133 { 134 trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING); 133 135 $this->mysql = null; 136 return; 134 137 } 135 138 } … … 137 140 if (!in_array($this->options['extras']['prefix'] . 'items', $db)) 138 141 { 139 $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');142 $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); 140 143 if ($query === false) 141 144 { 145 trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING); 142 146 $this->mysql = null; 147 return; 143 148 } 144 149 } … … 154 159 { 155 160 if ($this->mysql === null) 161 { 162 return false; 163 } 164 165 $query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' . 166 '`' . $this->options['extras']['prefix'] . 'items` i ' . 167 'WHERE cd.id = i.feed_id ' . 168 'AND cd.mtime < (unix_timestamp() - :purge_time)'); 169 $query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']); 170 171 if (!$query->execute()) 156 172 { 157 173 return false; … … 380 396 return $time; 381 397 } 382 else 383 { 384 return false; 385 } 398 399 return false; 386 400 } 387 401 … … 401 415 $query->bindValue(':time', time()); 402 416 $query->bindValue(':id', $this->id); 403 if ($query->execute() && $query->rowCount() > 0) 404 { 405 return true; 406 } 407 else 408 { 409 return false; 410 } 417 418 return $query->execute() && $query->rowCount() > 0; 411 419 } 412 420 … … 427 435 $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id'); 428 436 $query2->bindValue(':id', $this->id); 429 if ($query->execute() && $query2->execute()) 430 { 431 return true; 432 } 433 else 434 { 435 return false; 436 } 437 438 return $query->execute() && $query2->execute(); 437 439 } 438 440 }
Note: See TracChangeset
for help on using the changeset viewer.