code review
This commit is contained in:
parent
675906d600
commit
dc4980d9aa
3 changed files with 12 additions and 13 deletions
11
src/Core.php
11
src/Core.php
|
@ -56,7 +56,7 @@ class Core
|
|||
dcCore::app()->callBehavior('improveAddAction', $list);
|
||||
|
||||
foreach ($list as $action) {
|
||||
if ($action instanceof Action && !isset($this->actions[$action->id()])) {
|
||||
if (($action instanceof Action) && !isset($this->actions[$action->id()])) {
|
||||
if (in_array($action->id(), $disabled)) {
|
||||
$this->disabled[$action->id()] = $action->name();
|
||||
} else {
|
||||
|
@ -95,12 +95,11 @@ class Core
|
|||
if (empty($this->logs)) {
|
||||
return 0;
|
||||
}
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
|
||||
$cur->log_msg = json_encode($this->logs);
|
||||
$cur->log_table = My::id();
|
||||
$id = dcCore::app()->log->addLog($cur);
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME);
|
||||
$cur->setField('log_msg', json_encode($this->logs));
|
||||
$cur->setField('log_table', My::id());
|
||||
|
||||
return $id;
|
||||
return dcCore::app()->log->addLog($cur);
|
||||
}
|
||||
|
||||
public function readLogs(int $id): array
|
||||
|
|
|
@ -97,18 +97,18 @@ class Install extends dcNsProcess
|
|||
foreach (['setting_', 'preferences'] as $key) {
|
||||
$record = dcCore::app()->con->select(
|
||||
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' .
|
||||
"WHERE setting_ns = '" . dcCore::app()->con->escape(My::id()) . "' " .
|
||||
"WHERE setting_ns = '" . dcCore::app()->con->escapeStr(My::id()) . "' " .
|
||||
"AND setting_id LIKE '" . $key . "%' "
|
||||
);
|
||||
|
||||
while ($record->fetch()) {
|
||||
try {
|
||||
$value = @unserialize($record->f('setting_value'));
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
||||
$cur->setting_value = json_encode(is_array($value) ? $value : []);
|
||||
$value = @unserialize($record->f('setting_value'));
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
||||
$cur->setField('setting_value', json_encode(is_array($value) ? $value : []));
|
||||
$cur->update(
|
||||
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = '" . dcCore::app()->con->escape($record->f('setting_ns')) . "' " .
|
||||
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escape($record->f('blog_id')) . "' "))
|
||||
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = '" . dcCore::app()->con->escapeStr($record->f('setting_ns')) . "' " .
|
||||
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escapeStr($record->f('blog_id')) . "' "))
|
||||
);
|
||||
} catch(Exception) {
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ class zip extends Action
|
|||
$zip->addExclusion($e);
|
||||
}
|
||||
$zip->addDirectory(
|
||||
Path::real($this->module->get('root')),
|
||||
(string) Path::real($this->module->get('root')),
|
||||
$this->module->getId(),
|
||||
true
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue