Fix #1377 Can not delete status bit

This commit is contained in:
Nicolas Le Goff
2013-07-30 18:16:47 +02:00
parent 025a58e00c
commit cbb506be2e

View File

@@ -254,11 +254,9 @@ class databox_status
public static function deleteStatus(Application $app, \databox $databox, $bit) public static function deleteStatus(Application $app, \databox $databox, $bit)
{ {
$status = self::getStatus($app, $sbas_id); $status = self::getStatus($app, $databox->get_sbas_id());
if (isset($status[$bit])) { if (isset($status[$bit])) {
$connbas = connection::getPDOConnection($app, $sbas_id);
$doc = $databox->get_dom_structure(); $doc = $databox->get_dom_structure();
if ($doc) { if ($doc) {
$xpath = $databox->get_xpath_structure(); $xpath = $databox->get_xpath_structure();
@@ -271,7 +269,7 @@ class databox_status
} }
if ($sbit->parentNode->removeChild($sbit)) { if ($sbit->parentNode->removeChild($sbit)) {
$sql = 'UPDATE record SET status = status&(~(1<<' . $bit . '))'; $sql = 'UPDATE record SET status = status&(~(1<<' . $bit . '))';
$stmt = $connbas->prepare($sql); $stmt = $databox->get_connection()->prepare($sql);
$stmt->execute(); $stmt->execute();
$stmt->closeCursor(); $stmt->closeCursor();
} }
@@ -287,7 +285,7 @@ class databox_status
$app['filesystem']->remove($status[$bit]['path_on']); $app['filesystem']->remove($status[$bit]['path_on']);
} }
unset(self::$_status[$sbas_id]->status[$bit]); unset(self::$_status[$databox->get_sbas_id()]->status[$bit]);
return true; return true;
} }