<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28502] trunk/src/wp-includes/cache.php: Add access modifiers to methods/members in `WP_Object_Cache`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28502">28502</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-05-19 05:15:20 +0000 (Mon, 19 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add access modifiers to methods/members in `WP_Object_Cache`. Add a magic `__get()` method for BC.

See <a href="http://core.trac.wordpress.org/ticket/27881">#27881</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescachephp">trunk/src/wp-includes/cache.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescachephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/cache.php (28501 => 28502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/cache.php  2014-05-19 05:10:45 UTC (rev 28501)
+++ trunk/src/wp-includes/cache.php     2014-05-19 05:15:20 UTC (rev 28502)
</span><span class="lines">@@ -268,7 +268,7 @@
</span><span class="cx">   * @access private
</span><span class="cx">   * @since 2.0.0
</span><span class="cx">   */
</span><del>-       var $cache = array ();
</del><ins>+        private $cache = array ();
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * The amount of times the cache data was already stored in the cache.
</span><span class="lines">@@ -277,7 +277,7 @@
</span><span class="cx">   * @access private
</span><span class="cx">   * @var int
</span><span class="cx">   */
</span><del>-       var $cache_hits = 0;
</del><ins>+        private $cache_hits = 0;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * Amount of times the cache did not have the request in cache
</span><span class="lines">@@ -286,7 +286,7 @@
</span><span class="cx">   * @access public
</span><span class="cx">   * @since 2.0.0
</span><span class="cx">   */
</span><del>-       var $cache_misses = 0;
</del><ins>+        public $cache_misses = 0;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * List of global groups
</span><span class="lines">@@ -295,7 +295,7 @@
</span><span class="cx">   * @access protected
</span><span class="cx">   * @since 3.0.0
</span><span class="cx">   */
</span><del>-       var $global_groups = array();
</del><ins>+        protected $global_groups = array();
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * The blog prefix to prepend to keys in non-global groups.
</span><span class="lines">@@ -304,9 +304,20 @@
</span><span class="cx">   * @access private
</span><span class="cx">   * @since 3.5.0
</span><span class="cx">   */
</span><del>-       var $blog_prefix;
</del><ins>+        private $blog_prefix;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * Make private properties readable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @return mixed
+        */
+       public function __get( $name ) {
+               return $this->$name;
+       }
+
+       /**
</ins><span class="cx">    * Adds data to the cache if it doesn't already exist.
</span><span class="cx">   *
</span><span class="cx">   * @uses WP_Object_Cache::_exists Checks to see if the cache already has data.
</span><span class="lines">@@ -321,7 +332,7 @@
</span><span class="cx">   * @param int $expire When to expire the cache contents
</span><span class="cx">   * @return bool False if cache key and group already exist, true on success
</span><span class="cx">   */
</span><del>-       function add( $key, $data, $group = 'default', $expire = 0 ) {
</del><ins>+        public function add( $key, $data, $group = 'default', $expire = 0 ) {
</ins><span class="cx">           if ( wp_suspend_cache_addition() )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><span class="lines">@@ -345,7 +356,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @param array $groups List of groups that are global.
</span><span class="cx">   */
</span><del>-       function add_global_groups( $groups ) {
</del><ins>+        public function add_global_groups( $groups ) {
</ins><span class="cx">           $groups = (array) $groups;
</span><span class="cx"> 
</span><span class="cx">          $groups = array_fill_keys( $groups, true );
</span><span class="lines">@@ -362,7 +373,7 @@
</span><span class="cx">   * @param string $group The group the key is in.
</span><span class="cx">   * @return false|int False on failure, the item's new value on success.
</span><span class="cx">   */
</span><del>-       function decr( $key, $offset = 1, $group = 'default' ) {
</del><ins>+        public function decr( $key, $offset = 1, $group = 'default' ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -398,7 +409,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @return bool False if the contents weren't deleted and true on success
</span><span class="cx">   */
</span><del>-       function delete( $key, $group = 'default', $deprecated = false ) {
</del><ins>+        public function delete( $key, $group = 'default', $deprecated = false ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -419,7 +430,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @return bool Always returns true
</span><span class="cx">   */
</span><del>-       function flush() {
</del><ins>+        public function flush() {
</ins><span class="cx">           $this->cache = array ();
</span><span class="cx"> 
</span><span class="cx">          return true;
</span><span class="lines">@@ -442,7 +453,7 @@
</span><span class="cx">   * @return bool|mixed False on failure to retrieve contents or the cache
</span><span class="cx">   *              contents on success
</span><span class="cx">   */
</span><del>-       function get( $key, $group = 'default', $force = false, &$found = null ) {
</del><ins>+        public function get( $key, $group = 'default', $force = false, &$found = null ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -473,7 +484,7 @@
</span><span class="cx">   * @param string $group The group the key is in.
</span><span class="cx">   * @return false|int False on failure, the item's new value on success.
</span><span class="cx">   */
</span><del>-       function incr( $key, $offset = 1, $group = 'default' ) {
</del><ins>+        public function incr( $key, $offset = 1, $group = 'default' ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -508,7 +519,7 @@
</span><span class="cx">   * @param int $expire When to expire the cache contents
</span><span class="cx">   * @return bool False if not exists, true if contents were replaced
</span><span class="cx">   */
</span><del>-       function replace( $key, $data, $group = 'default', $expire = 0 ) {
</del><ins>+        public function replace( $key, $data, $group = 'default', $expire = 0 ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -528,7 +539,7 @@
</span><span class="cx">   * @since 3.0.0
</span><span class="cx">   * @deprecated 3.5.0
</span><span class="cx">   */
</span><del>-       function reset() {
</del><ins>+        public function reset() {
</ins><span class="cx">           _deprecated_function( __FUNCTION__, '3.5', 'switch_to_blog()' );
</span><span class="cx"> 
</span><span class="cx">          // Clear out non-global caches since the blog ID has changed.
</span><span class="lines">@@ -558,7 +569,7 @@
</span><span class="cx">   * @param int $expire Not Used
</span><span class="cx">   * @return bool Always returns true
</span><span class="cx">   */
</span><del>-       function set( $key, $data, $group = 'default', $expire = 0 ) {
</del><ins>+        public function set( $key, $data, $group = 'default', $expire = 0 ) {
</ins><span class="cx">           if ( empty( $group ) )
</span><span class="cx">                  $group = 'default';
</span><span class="cx"> 
</span><span class="lines">@@ -580,7 +591,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @since 2.0.0
</span><span class="cx">   */
</span><del>-       function stats() {
</del><ins>+        public function stats() {
</ins><span class="cx">           echo "<p>";
</span><span class="cx">          echo "<strong>Cache Hits:</strong> {$this->cache_hits}<br />";
</span><span class="cx">          echo "<strong>Cache Misses:</strong> {$this->cache_misses}<br />";
</span><span class="lines">@@ -601,7 +612,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @param int $blog_id Blog ID
</span><span class="cx">   */
</span><del>-       function switch_to_blog( $blog_id ) {
</del><ins>+        public function switch_to_blog( $blog_id ) {
</ins><span class="cx">           $blog_id = (int) $blog_id;
</span><span class="cx">          $this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
</span><span class="cx">  }
</span><span class="lines">@@ -623,7 +634,7 @@
</span><span class="cx">   * @since 2.0.8
</span><span class="cx">   * @return null|WP_Object_Cache If cache is disabled, returns null.
</span><span class="cx">   */
</span><del>-       function __construct() {
</del><ins>+        public function __construct() {
</ins><span class="cx">           global $blog_id;
</span><span class="cx"> 
</span><span class="cx">          $this->multisite = is_multisite();
</span><span class="lines">@@ -646,7 +657,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @return bool True value. Won't be used by PHP
</span><span class="cx">   */
</span><del>-       function __destruct() {
</del><ins>+        public function __destruct() {
</ins><span class="cx">           return true;
</span><span class="cx">  }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>