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