Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8 Deleting a source in Backdrop tries to delete a block from a table that doesn’t exist #19

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions aggregator.install
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
* Implements hook_uninstall().
*/
function aggregator_uninstall() {
variable_del('aggregator_allowed_html_tags');
variable_del('aggregator_summary_items');
variable_del('aggregator_clear');
variable_del('aggregator_category_selector');
variable_del('aggregator_fetcher');
variable_del('aggregator_parser');
variable_del('aggregator_processors');
variable_del('aggregator_teaser_length');
$config = config_get('aggregator.settings');
$config->delete();
}

/**
Expand Down Expand Up @@ -340,3 +334,10 @@ function aggregator_update_last_removed() {
function aggregator_update_1001() {
config_set('aggregator.settings', 'aggregator_ssl_verification', TRUE);
}

/**
* Set default value for date_format setting.
*/
function aggregator_update_1002() {
config_set('aggregator.settings', 'date_format', 'D, m/d/Y - H:i');
}
32 changes: 17 additions & 15 deletions aggregator.module
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,12 @@ function aggregator_save_category($edit) {
->condition('cid', $edit['cid'])
->execute();
// Make sure there is no active block for this category.
if (module_exists('block')) {
db_delete('block')
->condition('module', 'aggregator')
->condition('delta', 'category-' . $edit['cid'])
->execute();
}
// if (module_exists('block')) {
// db_delete('block')
// ->condition('module', 'aggregator')
// ->condition('delta', 'category-' . $edit['cid'])
// ->execute();
// }
$edit['title'] = '';
$op = 'delete';
}
Expand Down Expand Up @@ -524,12 +524,12 @@ function aggregator_save_feed($edit) {
->condition('fid', $edit['fid'])
->execute();
// Make sure there is no active block for this feed.
if (module_exists('block')) {
db_delete('block')
->condition('module', 'aggregator')
->condition('delta', 'feed-' . $edit['fid'])
->execute();
}
// if (module_exists('block')) {
// db_delete('block')
// ->condition('module', 'aggregator')
// ->condition('delta', 'feed-' . $edit['fid'])
// ->execute();
// }
}
elseif (!empty($edit['title'])) {
$edit['fid'] = db_insert('aggregator_feed')
Expand Down Expand Up @@ -766,9 +766,11 @@ function aggregator_sanitize_configuration() {
}
}
if ($reset) {
variable_del('aggregator_fetcher');
variable_del('aggregator_parser');
variable_del('aggregator_processors');
$config = config_get('aggregator.settings');
$config->clear('fetcher');
$config->clear('parser');
$config->clear('processors');
$config->save();
return TRUE;
}
return FALSE;
Expand Down
3 changes: 2 additions & 1 deletion aggregator.pages.inc
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ function template_preprocess_aggregator_item(&$variables) {
$variables['source_date'] = t('%ago ago', array('%ago' => format_interval(REQUEST_TIME - $item->timestamp)));
}
else {
$variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i'));
$format = config_get('aggregator.settings', 'date_format');
$variables['source_date'] = format_date($item->timestamp, 'custom', $format);
}

$variables['categories'] = array();
Expand Down
3 changes: 2 additions & 1 deletion config/aggregator.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"feed_item_length": "fulltext",
"teaser_length": 600,
"clear": 9676800,
"aggregator_ssl_verification": true
"aggregator_ssl_verification": true,
"date_format": "D, m/d/Y - H:i"
}