Merge "(bug 40098) Don't parse the section's name in the summary when creating a...
[lhc/web/wiklou.git] / includes / ZhClient.php
index 8bb36b2..4299841 100644 (file)
@@ -1,4 +1,24 @@
 <?php
+/**
+ * Client for querying zhdaemon.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
 
 /**
  * Client for querying zhdaemon
@@ -41,10 +61,7 @@ class ZhClient {
                $errno = $errstr = '';
                $this->mFP = fsockopen( $this->mHost, $this->mPort, $errno, $errstr, 30 );
                wfRestoreWarnings();
-               if ( !$this->mFP ) {
-                       return false;
-               }
-               return true;
+               return !$this->mFP;
        }
 
        /**
@@ -77,10 +94,7 @@ class ZhClient {
                        $data .= $str;
                }
                // data should be of length $len. otherwise something is wrong
-               if ( strlen( $data ) != $len ) {
-                       return false;
-               }
-               return $data;
+               return strlen( $data ) == $len;
        }
 
        /**
@@ -124,6 +138,7 @@ class ZhClient {
                }
                return $ret;
        }
+
        /**
         * Perform word segmentation
         *