]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Use Rector to upgrade constructors.
authorJason <jasonmm.github@gmail.com>
Tue, 21 Jun 2022 23:18:32 +0000 (18:18 -0500)
committerJason <jasonmm.github@gmail.com>
Tue, 21 Jun 2022 23:18:37 +0000 (18:18 -0500)
Modern PHP versions do not recognize methods with the same name as the
class as being constructors. This commit upgrades the code so that
constructors are named `__construct`. The upgrade was done automatically
using Rector.

src/SemanticScuttle/db/db2.php
src/SemanticScuttle/db/mssql-odbc.php
src/SemanticScuttle/db/mssql.php
src/SemanticScuttle/db/mysql.php
src/SemanticScuttle/db/mysql4.php
src/SemanticScuttle/db/mysqli.php
src/SemanticScuttle/db/oracle.php
src/SemanticScuttle/db/postgres.php
src/SemanticScuttle/db/sqlite.php
src/php-gettext/gettext.php
src/php-gettext/streams.php

index b1abf1a0ef905c8420ea10346178f526e4b3308e..117ecaeaacbc7f68bfe1a2011757919c2e9f6ed0 100644 (file)
@@ -36,7 +36,7 @@ class sql_db
        //
        // Constructor
        //
-       function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
+       function __construct($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
        {
                $this->persistency = $persistency;
                $this->user = $sqluser;
@@ -414,4 +414,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index a2d3d0246927fc8c67da392c40c7d43129fe9b27..f8b7db34e7fee9adad05c9f6533fc3125949d8f6 100644 (file)
@@ -184,7 +184,7 @@ class sql_db
        function _odbc_execute_query($query)
        {
                $result = false;
-               
+
                if (eregi("^SELECT ", $query))
                {
                        $result = @odbc_exec($this->db_connect_id, $query); 
@@ -459,7 +459,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -573,4 +573,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index 2b17b9e86708a9ab98e0f5469d75b776589d5c94..8358d27d662817355edf08c1101af25f9640a1d3 100644 (file)
@@ -134,7 +134,7 @@ class sql_db
                        if (!$this->query_result)
                        {
                                $this->num_queries++;
-                               
+
                                if (($this->query_result = @mssql_query($query, $this->db_connect_id)) === false)
                                {
                                        $this->sql_error($query);
@@ -285,7 +285,7 @@ class sql_db
                }
 
                $row = @mssql_fetch_array($query_id, MSSQL_ASSOC);
-               
+
                if ($row)
                {
                        foreach ($row as $key => $value)
@@ -431,7 +431,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -548,4 +548,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index a646e0d0a31420461c89d841d3b5a5e44c65a2ef..88b59d8fbb02c03dd1368a5ea12413726a625237 100644 (file)
@@ -94,7 +94,7 @@ class sql_db
                        case 'commit':
                                $result = @mysql_query('COMMIT', $this->db_connect_id);
                                $this->transaction = false;
-                               
+
                                if (!$result)
                                {
                                        @mysql_query('ROLLBACK', $this->db_connect_id);
@@ -291,7 +291,7 @@ class sql_db
                        }
                        return $result;
                }
-               
+
                return false;
        }
 
@@ -372,7 +372,7 @@ class sql_db
                        return mysql_escape_string($msg);
                }               
        }
-       
+
        function sql_error($sql = '')
        {
                if (!$this->return_on_error)
@@ -386,7 +386,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -463,7 +463,7 @@ class sql_db
                                                        {
                                                                $html_table = TRUE;
                                                                $html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-                                                               
+
                                                                foreach (array_keys($row) as $val)
                                                                {
                                                                        $html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -549,4 +549,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index 063951816d23adb9c02a07722d450da0d02d390c..c13bcbdf6fd4ef34571e37c72db3bb3f0a7c76f8 100644 (file)
@@ -94,7 +94,7 @@ class sql_db
                        case 'commit':
                                $result = @mysql_query('COMMIT', $this->db_connect_id);
                                $this->transaction = false;
-                               
+
                                if (!$result)
                                {
                                        @mysql_query('ROLLBACK', $this->db_connect_id);
@@ -291,7 +291,7 @@ class sql_db
                        }
                        return $result;
                }
-               
+
                return false;
        }
 
@@ -372,7 +372,7 @@ class sql_db
                        return mysql_escape_string($msg);
                }               
        }
-       
+
        function sql_error($sql = '')
        {
                if (!$this->return_on_error)
@@ -386,7 +386,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -463,7 +463,7 @@ class sql_db
                                                        {
                                                                $html_table = TRUE;
                                                                $html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-                                                               
+
                                                                foreach (array_keys($row) as $val)
                                                                {
                                                                        $html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -549,4 +549,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index 9a2709af8d902c696f25c9298fccfaf4db8aa1f9..fcff8480118511515d68ac189b3cc4304c889ba8 100644 (file)
@@ -129,7 +129,7 @@ class sql_db
                        }
 
                        $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
-                       
+
                        if (!$this->query_result)
                        {
                                $this->num_queries++;
@@ -286,7 +286,7 @@ class sql_db
 
                        unset($this->rowset[$cur_index]);
                        unset($this->row[$cur_index]);
-                       
+
                        $result = array();
                        while ($this->rowset[$cur_index] = $this->sql_fetchrow($query_id))
                        {
@@ -316,7 +316,7 @@ class sql_db
                        else
                        {
                                $cur_index = (is_object($query_id)) ? $query_id->cur_index : $query_id;
-       
+
                                if (empty($this->row[$cur_index]) && empty($this->rowset[$cur_index]))
                                {
                                        if ($this->row[$cur_index] = $this->sql_fetchrow($query_id))
@@ -382,7 +382,7 @@ class sql_db
        function sql_escape($msg) {
                return mysqli_real_escape_string($this->db_connect_id, $msg);
        }
-       
+
        function sql_error($sql = '')
        {
                if (!$this->return_on_error)
@@ -396,7 +396,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -473,7 +473,7 @@ class sql_db
                                                        {
                                                                $html_table = TRUE;
                                                                $html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-                                                               
+
                                                                foreach (array_keys($row) as $val)
                                                                {
                                                                        $html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -559,4 +559,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index 7ef10e5f5314a5f9c30237f89e84a427636d7931..8b983d3408382455df412705950034228f9d4e6c 100644 (file)
@@ -34,7 +34,7 @@ class sql_db
        //
        // Constructor
        //
-       function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
+       function __construct($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
        {
                $this->persistency = $persistency;
                $this->user = $sqluser;
@@ -465,4 +465,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index b5bad20e7a6743cbe63c7d4e8d961329e3e48f87..20853599c4a50b1248dc830355304fd134dab5c8 100644 (file)
@@ -58,7 +58,7 @@ class sql_db
                                {
                                        $this->connect_string .= "host=$sqlserver ";
                                }
-                       
+
                                if ($port)
                                {
                                        $this->connect_string .= "port=$port ";
@@ -152,7 +152,7 @@ class sql_db
                        }
 
                        $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
-                       
+
                        if (!$this->query_result)
                        {
                                $this->num_queries++;
@@ -308,7 +308,7 @@ class sql_db
                }
 
                $result = @pg_fetch_array($query_id, NULL, PGSQL_ASSOC);
-               
+
                if ($result)
                {
                        $this->rownum[$query_id]++;
@@ -477,7 +477,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -594,4 +594,4 @@ class sql_db
 
 } // if ... defined
 
-?>
\ No newline at end of file
+?>
index 1591396f3bed041a80ce3716e4adf0964cce6deb..64d437178a9a81a2c70a49897b37c5dd4aaded2e 100644 (file)
@@ -368,7 +368,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
@@ -384,4 +384,4 @@ class sql_db
 
 } // if ... define
 
-?>
\ No newline at end of file
+?>
index a121f9c7e7f5c24711b2f2cc7f71082f5f2a51c5..5b3886e01ce220bc2002a5a020c48793ecbcfd13 100644 (file)
@@ -98,7 +98,7 @@ class gettext_reader {
    * @param object Reader the StreamReader object
    * @param boolean enable_cache Enable or disable caching of strings (default on)
    */
-  function gettext_reader($Reader, $enable_cache = true) {
+  function __construct($Reader, $enable_cache = true) {
     // If there isn't a StreamReader, turn on short circuit mode.
     if (! $Reader || isset($Reader->error) ) {
       $this->short_circuit = true;
index 3cdc1584e1fa57451596c59a55f1dd03dc1a7939..de59a9a1cd032769aa5a4972c41a43d718be5c92 100644 (file)
@@ -46,12 +46,11 @@ class StreamReader {
 };
 
 class StringReader {
-  var $_pos;
+  var $_pos = 0;
   var $_str;
 
-  function StringReader($str='') {
+  function __construct($str='') {
     $this->_str = $str;
-    $this->_pos = 0;
   }
 
   function read($bytes) {
@@ -86,7 +85,7 @@ class FileReader {
   var $_fd;
   var $_length;
 
-  function FileReader($filename) {
+  function __construct($filename) {
     if (file_exists($filename)) {
 
       $this->_length=filesize($filename);
@@ -143,7 +142,7 @@ class FileReader {
 // Preloads entire file in memory first, then creates a StringReader
 // over it (it assumes knowledge of StringReader internals)
 class CachedFileReader extends StringReader {
-  function CachedFileReader($filename) {
+  function __construct($filename) {
     if (file_exists($filename)) {
 
       $length=filesize($filename);