Subversion Repositories PHPX

Rev

Rev 68 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68 Rev 73
Line 119... Line 119...
119
    return parent::create(
119
    return parent::create(
120
      "mysql:host={$this->_host}"
120
      "mysql:host={$this->_host}"
121
      . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''),
121
      . (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''),
122
      $username, $password, null, $force);
122
      $username, $password, null, $force);
123
  }
123
  }
-
 
124
-
 
125
  /**
-
 
126
   * Returns the date of last modification of this database or
-
 
127
   * one of its tables.
-
 
128
   *
-
 
129
   * @param string $table (optional)
-
 
130
   *   Table name.  If not provided, all tables of this database
-
 
131
   *   are considered.
-
 
132
   * @return int|null
-
 
133
   *   Timestamp of last modification, or <code>null</code> if
-
 
134
   *   unavailable.
-
 
135
   */
-
 
136
  public function getLastModified ($table = null)
-
 
137
  {
-
 
138
    $filter = array('TABLE_SCHEMA' => $this->_dbname);
-
 
139
-
 
140
    if ($table !== null)
-
 
141
    {
-
 
142
      $filter['TABLE_NAME'] = $table;
-
 
143
    }
-
 
144
-
 
145
    $times = $this->select(
-
 
146
      '`information_schema`.`tables`',
-
 
147
      array('CREATE_TIME', 'UPDATE_TIME'),
-
 
148
      $filter,
-
 
149
      array('UPDATE_TIME DESC', 'CREATE_TIME DESC'),
-
 
150
      1
-
 
151
    );
-
 
152
-
 
153
    $modi = ($times ? $times[0] : null);
-
 
154
-
 
155
    if ($modi)
-
 
156
    {
-
 
157
      $modi = $modi['UPDATE_TIME'] ?: $modi['CREATE_TIME'];
-
 
158
-
 
159
      if ($modi)
-
 
160
      {
-
 
161
        $modi = strtotime($modi . ' GMT');
-
 
162
      }
-
 
163
    }
-
 
164
-
 
165
    return $modi;
-
 
166
  }
124
}
167
}
125
168