INFRA-132 - Put "else" and "catch" on new line
[civicrm-core.git] / CRM / Logging / Schema.php
index b67d3af955ba03b2bdf276171bd3d4ad5b9d997e..244617654d8227082bb91680c9fb11cdbd4cb434 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -55,7 +55,7 @@ class CRM_Logging_Schema {
   /**
    * Populate $this->tables and $this->logs with current db state.
    */
-  function __construct() {
+  public function __construct() {
     $dao = new CRM_Contact_DAO_Contact();
     $civiDBName = $dao->_database;
 
@@ -107,14 +107,14 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
   /**
    * Return logging custom data tables.
    */
-  function customDataLogTables() {
+  public function customDataLogTables() {
     return preg_grep('/^log_civicrm_value_/', $this->logs);
   }
 
   /**
    * Return custom data tables for specified entity / extends.
    */
-  function entityCustomDataLogTables($extends) {
+  public function entityCustomDataLogTables($extends) {
     $customGroupTables = array();
     $customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
     $customGroupDAO->find();
@@ -127,7 +127,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
   /**
    * Disable logging by dropping the triggers (but keep the log tables intact).
    */
-  function disableLogging() {
+  public function disableLogging() {
     $config = CRM_Core_Config::singleton();
     $config->logging = FALSE;
 
@@ -142,7 +142,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
   /**
    * Drop triggers for all logged tables.
    */
-  function dropTriggers($tableName = NULL) {
+  public function dropTriggers($tableName = NULL) {
     $dao = new CRM_Core_DAO;
 
     if ($tableName) {
@@ -186,7 +186,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
    *
    * @return void
    */
-  function enableLogging() {
+  public function enableLogging() {
     $this->fixSchemaDifferences(TRUE);
     $this->addReports();
   }
@@ -198,7 +198,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
    *
    * @return void
    */
-  function fixSchemaDifferences($enableLogging = FALSE) {
+  public function fixSchemaDifferences($enableLogging = FALSE) {
     $config = CRM_Core_Config::singleton();
     if ($enableLogging) {
       $config->logging = TRUE;
@@ -213,13 +213,16 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
   /**
    * Add missing (potentially specified) log table columns for the given table.
    *
-   * @param $table string  name of the relevant table
-   * @param $cols mixed    array of columns to add or null (to check for the missing columns)
-   * @param $rebuildTrigger boolean should we rebuild the triggers
+   * @param $table
+   *   String name of the relevant table.
+   * @param $cols
+   *   Mixed array of columns to add or null (to check for the missing columns).
+   * @param $rebuildTrigger
+   *   Boolean should we rebuild the triggers.
    *
    * @return void
    */
-  function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
+  public function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
     if (empty($table)) {
       return FALSE;
     }
@@ -289,7 +292,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
   /**
    * @param bool $rebuildTrigger
    */
-  function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
+  public function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
     $diffs = array();
     foreach ($this->tables as $table) {
       if (empty($this->logs[$table])) {
@@ -320,7 +323,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
    *
    * @return mixed
    */
-  function fixTimeStampAndNotNullSQL($query) {
+  public function fixTimeStampAndNotNullSQL($query) {
     $query = str_ireplace("TIMESTAMP NOT NULL", "TIMESTAMP NULL", $query);
     $query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query);
     $query = str_ireplace("DEFAULT CURRENT_TIMESTAMP", '', $query);
@@ -423,7 +426,7 @@ WHERE  table_schema IN ('{$this->db}', '{$civiDB}')";
    *
    * @return array
    */
-  function columnsWithDiffSpecs($civiTable, $logTable) {
+  public function columnsWithDiffSpecs($civiTable, $logTable) {
     $civiTableSpecs = $this->columnSpecsOf($civiTable);
     $logTableSpecs  = $this->columnSpecsOf($logTable);
 
@@ -446,11 +449,13 @@ WHERE  table_schema IN ('{$this->db}', '{$civiDB}')";
         if ($civiTableSpecs[$col]['DATA_TYPE'] != CRM_Utils_Array::value('DATA_TYPE', $logTableSpecs[$col])) {
           // if data-type is different, surely consider the column
           $diff['MODIFY'][] = $col;
-        } else if ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
+        }
+        else if ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
           $logTableSpecs[$col]['IS_NULLABLE'] == 'NO') {
           // if is-null property is different, and log table's column is NOT-NULL, surely consider the column
           $diff['MODIFY'][] = $col;
-        } else if ($civiTableSpecs[$col]['COLUMN_DEFAULT'] != CRM_Utils_Array::value('COLUMN_DEFAULT', $logTableSpecs[$col]) &&
+        }
+        else if ($civiTableSpecs[$col]['COLUMN_DEFAULT'] != CRM_Utils_Array::value('COLUMN_DEFAULT', $logTableSpecs[$col]) &&
           !strstr($civiTableSpecs[$col]['COLUMN_DEFAULT'], 'TIMESTAMP')) {
           // if default property is different, and its not about a timestamp column, consider it
           $diff['MODIFY'][] = $col;
@@ -563,7 +568,7 @@ COLS;
    * @param null $tableName
    * @param bool $force
    */
-  function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
+  public function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
     // check if we have logging enabled
     $config =& CRM_Core_Config::singleton();
     if (!$config->logging) {
@@ -653,9 +658,8 @@ COLS;
    * an audit trail
    *
    * @static
-   * @public
    */
-  static function disableLoggingForThisConnection( ) {
+  public static function disableLoggingForThisConnection( ) {
     // do this only if logging is enabled
     $config = CRM_Core_Config::singleton( );
     if ( $config->logging ) {
@@ -664,4 +668,3 @@ COLS;
   }
 
 }
-