Ticket #1351: core.Tracker.Db.Mysqli.patch

File core.Tracker.Db.Mysqli.patch, 5.3 KB (added by JulienM, 4 years ago)
  • lang/en.php

     
    152152        'General_ExceptionFilesizeMismatch' => 'File size mismatch: %1$s (expected length: %2$s, found: %3$s)', 
    153153        'General_ExceptionFileIntegrity' => 'Integrity check failed: %s', 
    154154        'General_ExceptionNonceMismatch' => 'Could not verify the security token on this form.', 
     155        'General_ExceptionVariableNotFound' => 'The required variable \'%s\' is not correct or has not been found in the API Request.', 
     156        'General_ExceptionModuleNotFound' => 'API module %s not found.', 
     157        'General_ExceptionMethodNotFound' => 'The method \'%s\' does not exist or is not available in the module \'%s\'.', 
     158        'General_ExceptionInvalidAPI' => 'Objects that provide an API must be Singleton and have a \'static public function getInstance()\' method.', 
     159        'General_ExceptionPluginNotActivated' => 'The plugin \'%s\' is not activated. You can activate the plugin on the \'Plugins admin\' page.', 
     160        'General_ExceptionInvalidMethodName' => 'The method name is invalid. Expected \'module.methodName\'', 
     161        'General_ExceptionIDArchiveNull' => 'idArchive is null', 
     162        'General_ExceptionSubtableNotFoundInArchive' => 'You are requesting a precise subTable but there is not such data in the Archive.', 
     163        'General_ExceptionInvalidPeriodOperation' => 'Operation not applicable.', 
     164        'General_ExceptionRSSFeedInvalidDataTable' => 'RSS Feed only used on Piwik_DataTable_Array with keyName = \'date\'', 
     165        'General_ExceptionXMLIllegalState' => 'Illegal state, what xml shall we return?', 
     166        'General_ExceptionFilterInvalidDataTable' => 'The filter accepts only a Piwik_DataTable object.', 
     167        'General_ExceptionTableNotFound' => 'The requested table (id = %d) couldn\'t be found in the DataTable Manager', 
     168        'General_ExceptionInvalidRendererFormat' => 'Renderer format \'%s\' not valid. Try \'xml\' or \'json\' or \'csv\' or \'html\' or \'php\' or \'original\' instead.', 
     169        'General_ExceptionRendererInvalidDataTable' => 'The renderer accepts only a Piwik_DataTable or an array of DataTable (Piwik_DataTable_Array) object.', 
     170        'General_ExceptionSubtableAlreadyAssociated' => 'Adding a subtable to the row, but it already has a subtable associated.', 
     171        'General_ExceptionColumnAlreadyInArray' => 'Column %s already in the array!', 
     172        'General_ExceptionMetadataAlreadyInArray' => 'Metadata %s already in the array!', 
     173        'General_ExceptionDateNotSubdivisable' => 'Adding a subperiod is not supported for Piwik_Period_Day', 
     174        'General_ExceptionInvalidPeriod' => 'The period \'%s\' is not supported. Try \'day\' or \'week\' or \'month\' or \'year\'', 
     175        'General_ExceptionInvalidInputDate' => 'The date must be a Piwik_Date object. %s', 
     176        'General_ExceptionInvalidDateRange' => 'The date \'%s\' is not a date range. Should have the following format: \'lastN\' or \'previousN\' or \'YYYY-MM-DD,YYYY-MM-DD\'.', 
     177        'General_ExceptionQueryError' => 'Error query: %s', 
     178        'General_ExceptionQueryErrorVerbose' => 'Error query: %s \n In query: %s \n Parameters: %s', 
     179        'General_ExceptionMysqliConnectFailed' => 'Connect failed: %s', 
     180        'General_ExceptionMysqliCharsetFailed' => 'Set Charset failed: %s', 
    155181        'General_WarningFileIntegritySkipped' => 'Development environment detected. File integrity check skipped.', 
    156182        'General_WarningFileIntegrityNoManifest' => 'File integrity check could not be performed due to missing manifest.inc.php.', 
    157183        'General_WarningFileIntegrityNoMd5file' => 'File integrity check could not be completed due to missing md5_file() function.', 
  • core/Tracker/Db/Mysqli.php

     
    7676                $this->connection = mysqli_connect($this->host, $this->username, $this->password, $this->dbname, $this->port, $this->socket); 
    7777                if(!$this->connection || mysqli_connect_errno()) 
    7878                { 
    79                         throw new Exception("Connect failed: " . mysqli_connect_error()); 
     79                        throw new Exception(Piwik_TranslateException('General_ExceptionMysqliConnectFailed', array(mysqli_connect_error()))); 
    8080                } 
    8181 
    8282                if($this->charset && !mysqli_set_charset($this->connection, $this->charset)) 
     
    8181 
    8282                if($this->charset && !mysqli_set_charset($this->connection, $this->charset)) 
    8383                { 
    84                         throw new Exception("Set Charset failed: " . mysqli_error($this->connection)); 
     84                        throw new Exception(Piwik_TranslateException('General_ExceptionMysqliCharsetFailed', array(mysqli_error($this->connection)))); 
    8585                } 
    8686 
    8787                $this->password = ''; 
     
    132132                        } 
    133133                        return $rows; 
    134134                } catch (Exception $e) { 
    135                         throw new Exception("Error query: ".$e->getMessage()); 
     135                        throw new Exception(Piwik_TranslateException('General_ExceptionQueryError', array($e->getMessage()))); 
    136136                } 
    137137        } 
    138138         
     
    168168                        } 
    169169                        return $row; 
    170170                } catch (Exception $e) { 
    171                         throw new Exception("Error query: ".$e->getMessage()); 
     171                        throw new Exception(Piwik_TranslateException('General_ExceptionQueryError', array($e->getMessage()))); 
    172172                } 
    173173        } 
    174174         
     
    211211                        } 
    212212                        return $result; 
    213213                } catch (Exception $e) { 
    214                         throw new Exception("Error query: ".$e->getMessage() . " 
    215                                                                 In query: $query 
    216                                                                 Parameters: ".var_export($parameters, true)); 
     214                        throw new Exception(Piwik_TranslateException('General_ExceptionQueryErrorVerbose', array($e->getMessage(), $query, var_export($parameters, true)))); 
    217215                } 
    218216        } 
    219217