<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[12824] trunk/wp-admin/includes: Add wp-admin/includes/ms-deprecated.php.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12824">12824</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-25 19:46:24 +0000 (Mon, 25 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add wp-admin/includes/ms-deprecated.php. Deprecate wpmu_checkAvailableSpace. Introduce is_upload_space_available(). see <a href="http://trac.wordpress.org/ticket/11762">#11762</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesadminphp">trunk/wp-admin/includes/admin.php</a></li>
<li><a href="#trunkwpadminincludesdeprecatedphp">trunk/wp-admin/includes/deprecated.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmsdeprecatedphp">trunk/wp-admin/includes/ms-deprecated.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesadminphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/admin.php (12823 => 12824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/admin.php        2010-01-25 18:50:01 UTC (rev 12823)
+++ trunk/wp-admin/includes/admin.php        2010-01-25 19:46:24 UTC (rev 12824)
</span><span class="lines">@@ -55,7 +55,9 @@
</span><span class="cx"> require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
</span><span class="cx"> 
</span><span class="cx"> /** WordPress Multi-Site support API */
</span><del>-if ( is_multisite() )
</del><ins>+if ( is_multisite() ) {
</ins><span class="cx">         require_once(ABSPATH . 'wp-admin/includes/ms.php');
</span><ins>+        require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php');
+}
</ins><span class="cx"> 
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkwpadminincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/deprecated.php (12823 => 12824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/deprecated.php        2010-01-25 18:50:01 UTC (rev 12823)
+++ trunk/wp-admin/includes/deprecated.php        2010-01-25 19:46:24 UTC (rev 12824)
</span><span class="lines">@@ -1,4 +1,12 @@
</span><span class="cx"> <?php
</span><ins>+/**
+ * Deprecated admin functions from past WordPress versions. You shouldn't use these
+ * globals and functions and look for the alternatives instead. The functions
+ * and globals will be removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ */
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Calculates the new dimentions for a downsampled image.
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (12823 => 12824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2010-01-25 18:50:01 UTC (rev 12823)
+++ trunk/wp-admin/includes/media.php        2010-01-25 19:46:24 UTC (rev 12824)
</span><span class="lines">@@ -1397,9 +1397,14 @@
</span><span class="cx"> <?php } ?>
</span><span class="cx"> </div>
</span><span class="cx"> 
</span><del>-<?php do_action('pre-upload-ui'); ?>
</del><ins>+<?php
+// Check quota for this blog if multisite
+if ( is_multisite() && !is_upload_space_available() )
+        wp_die( __('Sorry, you must delete files before you can upload any more.') );
</ins><span class="cx"> 
</span><del>-<?php if ( $flash ) : ?>
</del><ins>+do_action('pre-upload-ui');
+
+if ( $flash ) : ?>
</ins><span class="cx"> <script type="text/javascript">
</span><span class="cx"> //<![CDATA[
</span><span class="cx"> var swfu;
</span><span class="lines">@@ -2229,4 +2234,3 @@
</span><span class="cx"> add_filter('media_upload_gallery', 'media_upload_gallery');
</span><span class="cx"> 
</span><span class="cx"> add_filter('media_upload_library', 'media_upload_library');
</span><del>-
</del></span></pre></div>
<a id="trunkwpadminincludesmsdeprecatedphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/includes/ms-deprecated.php (0 => 12824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms-deprecated.php                                (rev 0)
+++ trunk/wp-admin/includes/ms-deprecated.php        2010-01-25 19:46:24 UTC (rev 12824)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+<?php
+
+/**
+ * Deprecated multisite admin functions from past WordPress versions. You shouldn't use these
+ * globals and functions and look for the alternatives instead. The functions
+ * and globals will be removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ */
+
+/**
+ * @deprecated 3.0
+ */
+function wpmu_menu() {
+        _deprecated_function(__FUNCTION__, '3.0', '' );
+        // deprecated. See #11763
+}
+
+/**
+  * Determines if the available space defined by the admin has been exceeded by the user. Dies if it has.
+  * @deprecated 3.0
+ */
+function wpmu_checkAvailableSpace() {
+        _deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available' );
+
+        if ( !is_upload_space_available() )
+                wp_die( __('Sorry, you must delete files before you can upload any more.') );
+}
+
+?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/includes/ms-deprecated.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (12823 => 12824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-01-25 18:50:01 UTC (rev 12823)
+++ trunk/wp-admin/includes/ms.php        2010-01-25 19:46:24 UTC (rev 12824)
</span><span class="lines">@@ -355,22 +355,65 @@
</span><span class="cx">         return $allowed_themes;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Determines if there is any upload space left in the current blog's quota.
+ *
+ * @return bool True if space is available, false otherwise.
+ */
+function is_upload_space_available() {
+        if ( get_site_option( 'upload_space_check_disabled' ) )
+                return true;
+
+        $space_allowed = get_space_allowed();
+
+        $dir_name = trailingslashit( BLOGUPLOADDIR );
+        if ( !(is_dir($dir_name) && is_readable($dir_name)) )
+                return true;
+
+          $dir = dir($dir_name);
+           $size = 0;
+
+        while ( $file = $dir->read() ) {
+                if ( $file != '.' && $file != '..' ) {
+                        if ( is_dir( $dir_name . $file) ) {
+                                $size += get_dirsize($dir_name . $file);
+                        } else {
+                                $size += filesize($dir_name . $file);
+                        }
+                }
+        }
+        $dir->close();
+        $size = $size / 1024 / 1024;
+
+        if ( ($space_allowed - $size) <= 0 )
+                return false;
+
+        return true;
+}
+
+/**
+ * Returns the upload quota for the current blog.
+ *
+ * @return int Quota
+ */
</ins><span class="cx"> function get_space_allowed() {
</span><del>-        $spaceAllowed = get_option("blog_upload_space");
-        if ( $spaceAllowed == false )
-                $spaceAllowed = get_site_option("blog_upload_space");
-        if ( empty($spaceAllowed) || !is_numeric($spaceAllowed) )
-                $spaceAllowed = 50;
</del><ins>+        $space_allowed = get_option('blog_upload_space');
+        if ( $space_allowed == false )
+                $space_allowed = get_site_option('blog_upload_space');
+        if ( empty($space_allowed) || !is_numeric($space_allowed) )
+                $space_allowed = 50;
</ins><span class="cx"> 
</span><del>-        return $spaceAllowed;
</del><ins>+        return $space_allowed;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function display_space_usage() {
</span><span class="cx">         $space = get_space_allowed();
</span><span class="cx">         $used = get_dirsize( BLOGUPLOADDIR )/1024/1024;
</span><span class="cx"> 
</span><del>-        if ($used > $space) $percentused = '100';
-        else $percentused = ( $used / $space ) * 100;
</del><ins>+        if ( $used > $space )
+                $percentused = '100';
+        else
+                $percentused = ( $used / $space ) * 100;
</ins><span class="cx"> 
</span><span class="cx">         if ( $space > 1000 ) {
</span><span class="cx">                 $space = number_format( $space / 1024 );
</span><span class="lines">@@ -459,40 +502,6 @@
</span><span class="cx">         return $id;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/*
-  Determines if the available space defined by the admin has been exceeded by the user
-*/
-function wpmu_checkAvailableSpace() {
-        if ( get_site_option( 'upload_space_check_disabled' ) ) {
-                return true;
-        }
-        $spaceAllowed = get_space_allowed();
-
-        $dirName = trailingslashit( BLOGUPLOADDIR );
-        if (!(is_dir($dirName) && is_readable($dirName)))
-                return;
-
-          $dir = dir($dirName);
-           $size = 0;
-
-        while($file = $dir->read()) {
-                if ($file != '.' && $file != '..') {
-                        if (is_dir( $dirName . $file)) {
-                                $size += get_dirsize($dirName . $file);
-                        } else {
-                                $size += filesize($dirName . $file);
-                        }
-                }
-        }
-        $dir->close();
-        $size = $size / 1024 / 1024;
-
-        if ( ($spaceAllowed - $size) <= 0 ) {
-                wp_die( __('Sorry, you must delete files before you can upload any more.') );
-        }
-}
-add_action('pre-upload-ui','wpmu_checkAvailableSpace');
-
</del><span class="cx"> function format_code_lang( $code = '' ) {
</span><span class="cx">         $code = strtolower(substr($code, 0, 2));
</span><span class="cx">         $lang_codes = array('aa' => 'Afar',  'ab' => 'Abkhazian',  'af' => 'Afrikaans',  'ak' => 'Akan',  'sq' => 'Albanian',  'am' => 'Amharic',  'ar' => 'Arabic',  'an' => 'Aragonese',  'hy' => 'Armenian',  'as' => 'Assamese',  'av' => 'Avaric',  'ae' => 'Avestan',  'ay' => 'Aymara',  'az' => 'Azerbaijani',  'ba' => 'Bashkir',  'bm' => 'Bambara',  'eu' => 'Basque',  'be' => 'Belarusian',  'bn' => 'Bengali',  'bh' => 'Bihari',  'bi' => 'Bislama',  'bs' => 'Bosnian',  'br' => 'Breton',  'bg' => 'Bulgarian',  'my' => 'Burmese',  'ca' => 'Catalan; Valencian',  'ch' => 'Chamorro',  'ce' => 'Chechen',  'zh' => 'Chinese',  'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic',  'cv' => 'Chuvash',  'kw' => 'Cornish',  'co' => 'Corsican',  'cr' => 'Cree',  'cs' => 'Czech',  'da' => 'Danish',  'dv' => 'Divehi; Dhivehi; Maldivian',  'nl' => 'Dutch; Flemish',  'dz' => 'Dzongkha',  'en' => 'English',  'eo' => 'Esperanto',  'et' => 'Estonian',  'ee' => 'Ewe',  'fo' => 'Faroese',  'fj' => 'Fijian',  'fi' => 'Finnish',  'fr' => 'French',  'fy' => 'Western Frisian',  'ff' => 'Fulah',  'ka' => 'Georgian',  'de' => 'German',  'gd' => 'Gaelic; Scottish Gaelic',  'ga' => 'Irish',  'gl' => 'Galician',  'gv' => 'Manx',  'el' => 'Greek, Modern',  'gn' => 'Guarani',  'gu' => 'Gujarati',  'ht' => 'Haitian; Haitian Creole',  'ha' => 'Hausa',  'he' => 'Hebrew',  'hz' => 'Herero',  'hi' => 'Hindi',  'ho' => 'Hiri Motu',  'hu' => 'Hungarian',  'ig' => 'Igbo',  'is' => 'Icelandic',  'io' => 'Ido',  'ii' => 'Sichuan Yi',  'iu' => 'Inuktitut',  'ie' => 'Interlingue',  'ia' => 'Interlingua (International Auxiliary Language Association)',  'id' => 'Indonesian',  'ik' => 'Inupiaq',  'it' => 'Italian',  'jv' => 'Javanese',  'ja' => 'Japanese',  'kl' => 'Kalaallisut; Greenlandic',  'kn' => 'Kannada',  'ks' => 'Kashmiri',  'kr' => 'Kanuri',  'kk' => 'Kazakh',  'km' => 'Central Khmer',  'ki' => 'Kikuyu; Gikuyu',  'rw' => 'Kinyarwanda',  'ky' => 'Kirghiz; Kyrgyz',  'kv' => 'Komi',  'kg' => 'Kongo',  'ko' => 'Korean',  'kj' => 'Kuanyama; Kwanyama',  'ku' => 'Kurdish',  'lo' => 'Lao',  'la' => 'Latin',  'lv' => 'Latvian',  'li' => 'Limburgan; Limburger; Limburgish',  'ln' => 'Lingala',  'lt' => 'Lithuanian',  'lb' => 'Luxembourgish; Letzeburgesch',  'lu' => 'Luba-Katanga',  'lg' => 'Ganda',  'mk' => 'Macedonian',  'mh' => 'Marshallese',  'ml' => 'Malayalam',  'mi' => 'Maori',  'mr' => 'Marathi',  'ms' => 'Malay',  'mg' => 'Malagasy',  'mt' => 'Maltese',  'mo' => 'Moldavian',  'mn' => 'Mongolian',  'na' => 'Nauru',  'nv' => 'Navajo; Navaho',  'nr' => 'Ndebele, South; South Ndebele',  'nd' => 'Ndebele, North; North Ndebele',  'ng' => 'Ndonga',  'ne' => 'Nepali',  'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian',  'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',  'no' => 'Norwegian',  'ny' => 'Chichewa; Chewa; Nyanja',  'oc' => 'Occitan, Provençal',  'oj' => 'Ojibwa',  'or' => 'Oriya',  'om' => 'Oromo',  'os' => 'Ossetian; Ossetic',  'pa' => 'Panjabi; Punjabi',  'fa' => 'Persian',  'pi' => 'Pali',  'pl' => 'Polish',  'pt' => 'Portuguese',  'ps' => 'Pushto',  'qu' => 'Quechua',  'rm' => 'Romansh',  'ro' => 'Romanian',  'rn' => 'Rundi',  'ru' => 'Russian',  'sg' => 'Sango',  'sa' => 'Sanskrit',  'sr' => 'Serbian',  'hr' => 'Croatian',  'si' => 'Sinhala; Sinhalese',  'sk' => 'Slovak',  'sl' => 'Slovenian',  'se' => 'Northern Sami',  'sm' => 'Samoan',  'sn' => 'Shona',  'sd' => 'Sindhi',  'so' => 'Somali',  'st' => 'Sotho, Southern',  'es' => 'Spanish; Castilian',  'sc' => 'Sardinian',  'ss' => 'Swati',  'su' => 'Sundanese',  'sw' => 'Swahili',  'sv' => 'Swedish',  'ty' => 'Tahitian',  'ta' => 'Tamil',  'tt' => 'Tatar',  'te' => 'Telugu',  'tg' => 'Tajik',  'tl' => 'Tagalog',  'th' => 'Thai',  'bo' => 'Tibetan',  'ti' => 'Tigrinya',  'to' => 'Tonga (Tonga Islands)',  'tn' => 'Tswana',  'ts' => 'Tsonga',  'tk' => 'Turkmen',  'tr' => 'Turkish',  'tw' => 'Twi',  'ug' => 'Uighur; Uyghur',  'uk' => 'Ukrainian',  'ur' => 'Urdu',  'uz' => 'Uzbek',  've' => 'Venda',  'vi' => 'Vietnamese',  'vo' => 'Volapük',  'cy' => 'Welsh',  'wa' => 'Walloon',  'wo' => 'Wolof',  'xh' => 'Xhosa',  'yi' => 'Yiddish',  'yo' => 'Yoruba',  'za' => 'Zhuang; Chuang',  'zu' => 'Zulu');
</span><span class="lines">@@ -553,10 +562,6 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
</span><span class="cx"> 
</span><del>-function wpmu_menu() {
-        // deprecated. See #11763
-}
-
</del><span class="cx"> function mu_options( $options ) {
</span><span class="cx">         if ( defined( 'POST_BY_EMAIL' ) ) {
</span><span class="cx">                 $writing = array( 'ping_sites' );
</span></span></pre>
</div>
</div>
</body>
</html>