Permalink
Browse files

Get rid of the final references to MDB

  • Loading branch information...
vanoudt committed May 23, 2017
1 parent 0ee1fe7 commit 224e12042a9dcebf4143bb4cfce5d8525642e67d
Showing with 11 additions and 12 deletions.
  1. +1 −5 README.md
  2. +1 −1 db_objects/attendance_record_set.class.php
  3. +8 −5 include/db_object.class.php
  4. +1 −1 include/installer.class.php
View
@@ -21,11 +21,7 @@ The steps to install are:
2. Create a mysql database and database user for your jethro system to use
3. Edit Jethro's configuration file conf.php and fill in the essential details (system name, URL, database details). Further explanation can be found inside the file.
4. Open the jethro system URL in your web browser
5. If you encounter an error about MDB2.php not being found, you need to install the MDB2 PEAR library. If you have command line access this can be done by running
<code>pear install MDB2
pear install MDB2_Driver_mysql</code>
If you don't have command line access you can unzip [this ZIP file](http://sourceforge.net/project/showfiles.php?group_id=192555&package_id=247862&release_id=544189) into your Jethro folder.
6. In your web browser, the Jethro installer will start automatically and will prompt you for details to create the initial user account. When the installer completes, it will prompt you to log into the installed system.
5.. In your web browser, the Jethro installer will start automatically and will prompt you for details to create the initial user account. When the installer completes, it will prompt you to log into the installed system.
# Documentation
@@ -188,7 +188,7 @@ function save()
$db =& $GLOBALS['db'];
$GLOBALS['system']->doTransaction('begin');
$this->delete();
$stmt = $db->prepare('REPLACE INTO attendance_record (date, groupid, personid, present) VALUES ('.$db->quote($this->date).', '.(int)$this->groupid.', ?, ?)', Array('integer', 'integer', 'integer'), MDB2_PREPARE_MANIP);
$stmt = $db->prepare('REPLACE INTO attendance_record (date, groupid, personid, present) VALUES ('.$db->quote($this->date).', '.(int)$this->groupid.', ?, ?)', Array('integer', 'integer', 'integer'));
check_db_result($stmt);
foreach ($this->_attendance_records as $personid => $present) {
$res = $stmt->execute(Array($personid, $present));
@@ -1,6 +1,5 @@
<?php
require_once 'MDB2/Date.php';
class db_object
{
@@ -48,6 +47,10 @@ public function __construct($id=0)
}
}
public function unixToTimestamp($unix_timestamp)
{
return date('Y-m-d H:i:s', $unix_timestamp);
}
public function getInitSQL($table_name=NULL)
{
@@ -756,7 +759,7 @@ public function haveLock($type='')
AND objectid = '.$db->quote($this->id).'
AND lock_type = '.$db->quote($type).'
AND userid = '.$GLOBALS['user_system']->getCurrentPerson('id').'
AND expires > '.$db->quote(MDB2_Date::unix2Mdbstamp(time()));
AND expires > '.$db->quote(self::unixToTimestamp(time()));
$this->_held_locks[$type] = $db->queryOne($sql);
check_db_result($this->_held_locks[$type]);
}
@@ -773,7 +776,7 @@ public function canAcquireLock($type='')
WHERE object_type = '.$db->quote(strtolower(get_class($this))).'
AND lock_type = '.$db->quote($type).'
AND objectid = '.$db->quote($this->id).'
AND expires > '.$db->quote(MDB2_Date::unix2Mdbstamp(time()));
AND expires > '.$db->quote(self::unixToTimestamp(time()));
$res = $db->queryOne($sql);
check_db_result($res);
if ($res == $GLOBALS['user_system']->getCurrentPerson('id')) {
@@ -798,7 +801,7 @@ public function acquireLock($type='')
'.$db->quote(strtolower(get_class($this))).',
'.$db->quote($type).',
'.$db->quote($GLOBALS['user_system']->getCurrentPerson('id')).',
'.$db->quote(MDB2_Date::unix2Mdbstamp(strtotime('+'.self::getLockLength()))).')';
'.$db->quote(self::unixToTimestamp(strtotime('+'.self::getLockLength()))).')';
$res = $db->query($sql);
check_db_result($res);
if ($res !== FALSE) $res->closeCursor();
@@ -807,7 +810,7 @@ public function acquireLock($type='')
if (rand(10, 100) == 100) {
$sql = 'DELETE FROM db_object_lock
WHERE expires < '.$db->quote(MDB2_Date::unix2Mdbstamp(time()));
WHERE expires < '.$db->quote(self::unixToTimestamp(time()));
$res = $db->query($sql);
check_db_result($res);
if ($res !== FALSE) $res->closeCursor();
@@ -406,7 +406,7 @@ function printForm()
{
$tables = $GLOBALS['db']->queryCol('SHOW TABLES');
$routines = $GLOBALS['db']->queryCol('SHOW CREATE FUNCTION getCurrentUserID');
if (!empty($tables) || !($routines instanceof MDB2_Error)) {
if (!empty($tables) || (($GLOBALS['db']->errorCode() !== '00000') && ($GLOBALS['db']->errorCode() !== NULL))) {
print_message('Your MySQL database is not empty. This could be due to a failed previous installation attempt. Please drop and re-create the database to ensure it is entirely blank, then reload this page.', 'error');
return;
}

0 comments on commit 224e120

Please sign in to comment.