Subversion Repositories oidplus

Rev

Rev 855 | Rev 1080 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 855 Rev 1050
Line 15... Line 15...
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
17
 * limitations under the License.
18
 */
18
 */
19
 
19
 
-
 
20
use ViaThinkSoft\OIDplus\OIDplusDatabaseConnection;
-
 
21
use ViaThinkSoft\OIDplus\OIDplusConfigInitializationException;
-
 
22
use ViaThinkSoft\OIDplus\OIDplusException;
-
 
23
 
20
/**
24
/**
21
 * This function will be called by OIDplusDatabaseConnection.class.php at method afterConnect().
25
 * This function will be called by OIDplusDatabaseConnection.class.php at method afterConnect().
22
 * @param OIDplusDatabaseConnection $db is the OIDplusDatabaseConnection class
26
 * @param OIDplusDatabaseConnection $db is the OIDplusDatabaseConnection class
23
 * @throws OIDplusException
27
 * @throws \ViaThinkSoft\OIDplus\OIDplusException
24
 */
28
 */
25
function oidplus_dbupdate(OIDplusDatabaseConnection $db) {
29
function oidplus_dbupdate(OIDplusDatabaseConnection $db) {
26
        // Detect database version
30
        // Detect database version
27
        $res = $db->query("SELECT value FROM ###config WHERE name = 'database_version'");
31
        $res = $db->query("SELECT value FROM ###config WHERE name = 'database_version'");
28
        $row = $res->fetch_array();
32
        $row = $res->fetch_array();
Line 70... Line 74...
70
                if ($version == 1000) {
74
                if ($version == 1000) {
71
                        // Update 1000 => 1001
75
                        // Update 1000 => 1001
72
                        require_once __DIR__.'/update1001.inc.php';
76
                        require_once __DIR__.'/update1001.inc.php';
73
                        $version = oidplus_dbupdate_1001($db);
77
                        $version = oidplus_dbupdate_1001($db);
74
                }
78
                }
75
        } catch (Exception $e) {
79
        } catch (\Exception $e) {
76
                throw new OIDplusException(_L('Database update from version %1 failed: %2',$version,$e->getMessage()));
80
                throw new OIDplusException(_L('Database update from version %1 failed: %2',$version,$e->getMessage()));
77
        }
81
        }
78
 
82
 
79
        // Don't allow if the database version if newer than we expect
83
        // Don't allow if the database version if newer than we expect
80
        if ($version > 1001) {
84
        if ($version > 1001) {