Apply staged updates
This commit is contained in:
@@ -360,6 +360,9 @@ class ArticleRepository
|
||||
public function archive(int $articleId): bool
|
||||
{
|
||||
$result = $this->db->update('pp_articles', ['status' => -1], ['id' => $articleId]);
|
||||
if ($result) {
|
||||
$this->db->delete('pp_routes', ['article_id' => $articleId]);
|
||||
}
|
||||
return (bool)$result;
|
||||
}
|
||||
|
||||
@@ -381,6 +384,7 @@ class ArticleRepository
|
||||
$this->db->delete('pp_articles_langs', ['article_id' => $articleId]);
|
||||
$this->db->delete('pp_articles_images', ['article_id' => $articleId]);
|
||||
$this->db->delete('pp_articles_files', ['article_id' => $articleId]);
|
||||
$this->db->delete('pp_routes', ['article_id' => $articleId]);
|
||||
$this->db->delete('pp_articles', ['id' => $articleId]);
|
||||
|
||||
\Shared\Helpers\Helpers::delete_dir('../upload/article_images/article_' . $articleId . '/');
|
||||
|
||||
@@ -174,6 +174,7 @@ class CategoryRepository
|
||||
|
||||
$deleted = (bool)$this->db->delete('pp_shop_categories', ['id' => $id]);
|
||||
if ($deleted) {
|
||||
$this->db->delete('pp_routes', ['category_id' => $id]);
|
||||
$this->refreshCategoryArtifacts();
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,11 @@ class PagesRepository
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)$this->db->delete('pp_pages', ['id' => $pageId]);
|
||||
$deleted = (bool)$this->db->delete('pp_pages', ['id' => $pageId]);
|
||||
if ($deleted) {
|
||||
$this->db->delete('pp_routes', ['page_id' => $pageId]);
|
||||
}
|
||||
return $deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -172,13 +172,19 @@ class UpdateRepository
|
||||
|
||||
foreach ( $manifest['sql'] as $query ) {
|
||||
$query = trim( $query );
|
||||
if ( $query !== '' ) {
|
||||
if ( $query === '' || strpos( $query, '--' ) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if ( $this->db->query( $query ) ) {
|
||||
$success++;
|
||||
} else {
|
||||
$errors++;
|
||||
$log[] = '[WARNING] Błąd SQL: ' . $query;
|
||||
}
|
||||
} catch ( \Exception $e ) {
|
||||
$errors++;
|
||||
$log[] = '[WARNING] Wyjątek SQL: ' . $e->getMessage() . ' | Query: ' . substr( $query, 0, 200 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user