]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-importer.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-importer.php
index ee10547deb58d45f620f4caeffec747c395b6420..794fa5cf0d07c3ed6c198b48bbb9365ed74062be 100644 (file)
@@ -12,6 +12,9 @@ class WP_Importer {
        /**
         * Returns array with imported permalinks from WordPress database
         *
        /**
         * Returns array with imported permalinks from WordPress database
         *
+        * @global wpdb $wpdb WordPress database abstraction object.
+        *
+        * @param string $importer_name
         * @param string $bid
         * @return array
         */
         * @param string $bid
         * @return array
         */
@@ -49,6 +52,9 @@ class WP_Importer {
        /**
         * Return count of imported permalinks from WordPress database
         *
        /**
         * Return count of imported permalinks from WordPress database
         *
+        * @global wpdb $wpdb WordPress database abstraction object.
+        *
+        * @param string $importer_name
         * @param string $bid
         * @return int
         */
         * @param string $bid
         * @return int
         */
@@ -75,6 +81,8 @@ class WP_Importer {
        /**
         * Set array with imported comments from WordPress database
         *
        /**
         * Set array with imported comments from WordPress database
         *
+        * @global wpdb $wpdb WordPress database abstraction object.
+        *
         * @param string $bid
         * @return array
         */
         * @param string $bid
         * @return array
         */
@@ -114,6 +122,11 @@ class WP_Importer {
                return $hashtable;
        }
 
                return $hashtable;
        }
 
+       /**
+        *
+        * @param int $blog_id
+        * @return int|void
+        */
        public function set_blog( $blog_id ) {
                if ( is_numeric( $blog_id ) ) {
                        $blog_id = (int) $blog_id;
        public function set_blog( $blog_id ) {
                if ( is_numeric( $blog_id ) ) {
                        $blog_id = (int) $blog_id;
@@ -123,13 +136,15 @@ class WP_Importer {
                                fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
                                exit();
                        }
                                fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
                                exit();
                        }
-                       if ( empty( $parsed['path'] ) )
+                       if ( empty( $parsed['path'] ) ) {
                                $parsed['path'] = '/';
                                $parsed['path'] = '/';
-                       $blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
-                       if ( !$blog ) {
+                       }
+                       $blogs = get_sites( array( 'domain' => $parsed['host'], 'number' => 1, 'path' => $parsed['path'] ) );
+                       if ( ! $blogs ) {
                                fwrite( STDERR, "Error: Could not find blog\n" );
                                exit();
                        }
                                fwrite( STDERR, "Error: Could not find blog\n" );
                                exit();
                        }
+                       $blog = array_shift( $blogs );
                        $blog_id = (int) $blog->blog_id;
                }
 
                        $blog_id = (int) $blog->blog_id;
                }
 
@@ -141,6 +156,11 @@ class WP_Importer {
                return $blog_id;
        }
 
                return $blog_id;
        }
 
+       /**
+        *
+        * @param int $user_id
+        * @return int|void
+        */
        public function set_user( $user_id ) {
                if ( is_numeric( $user_id ) ) {
                        $user_id = (int) $user_id;
        public function set_user( $user_id ) {
                if ( is_numeric( $user_id ) ) {
                        $user_id = (int) $user_id;
@@ -173,7 +193,7 @@ class WP_Importer {
         * @param string $url
         * @param string $username
         * @param string $password
         * @param string $url
         * @param string $username
         * @param string $password
-        * @param bool $head
+        * @param bool   $head
         * @return array
         */
        public function get_page( $url, $username = '', $password = '', $head = false ) {
         * @return array
         */
        public function get_page( $url, $username = '', $password = '', $head = false ) {
@@ -210,7 +230,6 @@ class WP_Importer {
        public function is_user_over_quota() {
                if ( function_exists( 'upload_is_user_over_quota' ) ) {
                        if ( upload_is_user_over_quota() ) {
        public function is_user_over_quota() {
                if ( function_exists( 'upload_is_user_over_quota' ) ) {
                        if ( upload_is_user_over_quota() ) {
-                               echo "Sorry, you have used your upload quota.\n";
                                return true;
                        }
                }
                                return true;
                        }
                }
@@ -231,7 +250,8 @@ class WP_Importer {
        /**
         * Reset global variables that grow out of control during imports
         *
        /**
         * Reset global variables that grow out of control during imports
         *
-        * @return void
+        * @global wpdb  $wpdb
+        * @global array $wp_actions
         */
        public function stop_the_insanity() {
                global $wpdb, $wp_actions;
         */
        public function stop_the_insanity() {
                global $wpdb, $wp_actions;
@@ -247,7 +267,7 @@ class WP_Importer {
  * Exits when a required param is not set.
  *
  * @param string $param
  * Exits when a required param is not set.
  *
  * @param string $param
- * @param bool $required
+ * @param bool   $required
  * @return mixed
  */
 function get_cli_args( $param, $required = false ) {
  * @return mixed
  */
 function get_cli_args( $param, $required = false ) {