1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Xmf\Database\Tables; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Upgrade from 2.5.10 to 2.5.11 |
7
|
|
|
* |
8
|
|
|
* See the enclosed file license.txt for licensing information. |
9
|
|
|
* If you did not receive this file, get it at https://www.gnu.org/licenses/gpl-2.0.html |
10
|
|
|
* |
11
|
|
|
* @copyright (c) 2000-2019 XOOPS Project (https://xoops.org) |
12
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
13
|
|
|
* @package Upgrade |
14
|
|
|
* @since 2.5.11 |
15
|
|
|
* @author XOOPS Team |
16
|
|
|
*/ |
17
|
|
|
class Upgrade_2511 extends XoopsUpgrade |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* __construct |
21
|
|
|
*/ |
22
|
|
|
public function __construct() |
23
|
|
|
{ |
24
|
|
|
parent::__construct(basename(__DIR__)); |
25
|
|
|
$this->tasks = array('qmail'); |
26
|
|
|
$this->usedFiles = array(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Add qmail as valid mailmethod |
31
|
|
|
* |
32
|
|
|
* @return bool |
33
|
|
|
*/ |
34
|
|
|
public function check_qmail() |
35
|
|
|
{ |
36
|
|
|
/* @var XoopsMySQLDatabase $db */ |
37
|
|
|
$db = XoopsDatabaseFactory::getDatabaseConnection(); |
38
|
|
|
|
39
|
|
|
$table = $db->prefix('configoption'); |
40
|
|
|
|
41
|
|
|
$sql = sprintf( |
42
|
|
|
'SELECT count(*) FROM `%s` ' |
43
|
|
|
. "WHERE `conf_id` = 64 AND `confop_name` = 'qmail'", |
44
|
|
|
$db->escape($table) |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
/** @var mysqli_result $result */ |
48
|
|
|
$result = $db->query($sql); |
|
|
|
|
49
|
|
|
if ($result) { |
|
|
|
|
50
|
|
|
$row = $db->fetchRow($result); |
51
|
|
|
if ($row) { |
52
|
|
|
$count = $row[0]; |
53
|
|
|
return (0 === (int) $count) ? false : true; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
return false; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Add qmail as valid mailmethod |
61
|
|
|
* |
62
|
|
|
* phpMailer has qmail support, similar to but slightly different than sendmail |
63
|
|
|
* This will allow webmasters to utilize qmail if it is provisioned on server. |
64
|
|
|
* |
65
|
|
|
* @return bool |
66
|
|
|
*/ |
67
|
|
|
public function apply_qmail() |
68
|
|
|
{ |
69
|
|
|
$migrate = new Tables(); |
70
|
|
|
$migrate->useTable('configoption'); |
71
|
|
|
$migrate->insert('configoption', |
72
|
|
|
array('confop_name' => 'qmail', 'confop_value' => 'qmail', 'conf_id' => 64)); |
73
|
|
|
return $migrate->executeQueue(true); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
$upg = new Upgrade_2511(); |
78
|
|
|
return $upg; |
79
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.