-
Notifications
You must be signed in to change notification settings - Fork 0
/
volumes.php
45 lines (38 loc) · 1021 Bytes
/
volumes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include_once './utility/mysql.php';
class volumes
{
public static function get_all($status = 0)
{
$ret = array();
$res = mysql::queryf('SELECT * FROM volumes WHERE status = %d', $status);
while ( $r = mysql_fetch_object($res) )
{
$ret []= $r;
}
return $ret;
}
public static function get_volume($id)
{
$res = mysql::queryf('SELECT * FROM tasks WHERE id = %d', $id);
if ( $r = mysql_fetch_object($res) )
{
return $r;
}
return null;
}
public static function add_volume($path, $status = 0)
{
return mysql::insertf('INSERT INTO volumes VALUES( NULL, "%s", %d)',
$path, $status);
}
public static function get_by_path($path)
{
$res = mysql::queryf('SELECT * FROM tasks WHERE path = "%s"', $path);
if ( $r = mysql_fetch_object($res) )
{
return $r;
}
return null;
}
}