Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed May 15, 2024
1 parent cf00ea3 commit cda971b
Show file tree
Hide file tree
Showing 67 changed files with 79 additions and 80 deletions.
2 changes: 1 addition & 1 deletion lib/midcom/admin/folder/handler/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function _update_score(string $identifier, int $score) : bool
// Use the DB Factory to resolve the class and to get the object
try {
$object = midcom::get()->dbfactory->get_object_by_guid($identifier);
} catch (midcom_error $e) {
} catch (midcom_error) {
// This is probably a pseudo leaf, store the score to the current node
$this->_topic->set_parameter('midcom.helper.nav.score', $identifier, $score);
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/baseclasses/core/dbobject.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public static function refresh(midcom_core_dbaobject $object) : bool
*/
try {
return $object->get_by_id($object->id);
} catch (Exception $e) {
} catch (Exception) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function login(string $username, string $password, bool $trusted =

try {
$user = new midgard_user($login_tokens);
} catch (mgd_exception $e) {
} catch (mgd_exception) {
return null;
}
if (!$trusted && !self::verify_password($password, $user->password)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/core/privilege.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private function get_object() : ?midcom_core_dbaobject
if ($this->__cached_object === null) {
try {
$this->__cached_object = midcom::get()->dbfactory->get_object_by_guid($this->objectguid);
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/db/member.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private function _invalidate_person_cache()
}
try {
$person = new midcom_db_person($this->uid);
} catch (midcom_error $e) {
} catch (midcom_error) {
return;
}
midcom::get()->cache->invalidate($person->guid);
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/db/style.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function path_from_id(int $id) : string
break;
}
}
} catch (midcom_error $e) {
} catch (midcom_error) {
}

$path_parts = array_reverse($path_parts);
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/helper/_dbfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function get_parent(midcom_core_dbaobject $object) : ?midcom_core_dbaobje

try {
return $this->get_cached($classname, $parent_guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/helper/nav/leaf.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function prepare_data() : array
} elseif (!empty($this->data[MIDCOM_NAV_GUID])) {
try {
$this->data[MIDCOM_NAV_OBJECT] = midcom::get()->dbfactory->get_object_by_guid($this->data[MIDCOM_NAV_GUID]);
} catch (midcom_error $e) {
} catch (midcom_error) {
}
} else {
debug_add("Warning: The leaf {$this->leafid} of topic {$topic->id} does set neither a GUID nor an object.");
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/helper/reflector/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function get_object_label(object $object) : ?string
if ($object instanceof mgdobject) {
try {
$obj = midcom::get()->dbfactory->convert_midgard_to_midcom($object);
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/services/auth/backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function get_user($id) : ?midcom_core_user
if (!array_key_exists($id, $this->_user_cache)) {
try {
$this->_user_cache[$id] = new midcom_core_user($param);
} catch (midcom_error $e) {
} catch (midcom_error) {
// Keep it silent while missing user object can mess here
$this->_user_cache[$id] = null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/services/indexer/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private function read_person(string $guid) : ?midcom_db_person
{
try {
return midcom_db_person::get_cached($guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/midcom/services/indexer/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function query(string $query, midcom_services_indexer_filter $filter = nu
if (!empty($document->topic_guid)) {
try {
midcom_db_topic::get_cached($document->topic_guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
// Skip document, the object is hidden.
debug_add("Skipping the generic document {$document->title}, its topic seems to be invisible, we cannot proceed.");
continue;
Expand All @@ -209,7 +209,7 @@ public function query(string $query, midcom_services_indexer_filter $filter = nu
// Strip language code from end of RI if it looks like "<GUID>_<LANG>"
try {
midcom::get()->dbfactory->get_object_by_guid(preg_replace('/^([0-9a-f]{32,80})_[a-z]{2}$/', '\\1', $document->RI));
} catch (midcom_error $e) {
} catch (midcom_error) {
// Skip document, the object is hidden, deleted or otherwise unavailable.
//@todo Maybe nonexistent objects should be removed from index?
continue;
Expand Down
4 changes: 2 additions & 2 deletions lib/midgard/admin/asgard/handler/welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private function _mass_delete(array $guids)
foreach ($guids as $guid) {
try {
$object = midcom::get()->dbfactory->get_object_by_guid($guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
continue;
}

Expand All @@ -192,7 +192,7 @@ private function _mass_approve(array $guids)
foreach ($guids as $guid) {
try {
$object = midcom::get()->dbfactory->get_object_by_guid($guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/midgard/admin/asgard/style/ASGARD_ROOT.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
try {
$creator = new midcom_db_person($view_metadata->get('creator'));
$creator_string = "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/view/{$creator->guid}/\">$creator->name</a>";
} catch (midcom_error $e) {
} catch (midcom_error) {
$creator_string = $l10n->get('unknown person');
}
$formatter = $data['l10n']->get_formatter();
Expand All @@ -133,7 +133,7 @@
try {
$editor = new midcom_db_person($view_metadata->get('revisor'));
$editor_string = "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/view/{$editor->guid}/\">$editor->name</a>";
} catch (midcom_error $e) {
} catch (midcom_error) {
$editor_string = $l10n->get('unknown person');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/midgard/admin/user/handler/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private function _batch_passwords(Request $request, midcom_db_person $person)

try {
$account = new midcom_core_account($person);
} catch (midcom_error $e) {
} catch (midcom_error) {
midcom::get()->uimessages->add($this->_l10n->get('midgard.admin.user'), sprintf($this->_l10n->get('failed to get the user with id %s'), $person->id), 'error');
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
foreach ($data['objects'] as $guid => $privs) {
try {
$object = new midcom_db_topic($guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
continue;
}
echo "<tr>\n";
Expand Down
2 changes: 1 addition & 1 deletion lib/net/nehmer/comments/midcom/interfaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function get_node(midcom_db_topic $topic, $node_id) : ?array
if ($node_id) {
try {
$comments_topic = new midcom_db_topic($node_id);
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/net/nemein/rss/cron/fetchfeeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function execute()
foreach ($qb->execute() as $feed) {
try {
midcom_db_topic::get_cached($feed->node);
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR);
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/org/openpsa/calendar/conflictmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private function _process_resource(org_openpsa_calendar_event_resource_dba $memb
try {
$event = new org_openpsa_calendar_event_dba($member->event);
$set_as_modified = true;
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("event_resource #{$member->id} links to bogus event #{$member->event}, skipping and removing", MIDCOM_LOG_WARN);
$member->delete();
return;
Expand Down Expand Up @@ -170,7 +170,7 @@ private function _process_participant(org_openpsa_calendar_event_member_dba $mem

try {
$event = new org_openpsa_calendar_event_dba($member->eid);
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("eventmember #{$member->id} links to bogus event #{$member->eid}, skipping and removing", MIDCOM_LOG_WARN);
$member->delete();
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/calendar/event/member.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function get_person_obj() : ?midcom_db_person
debug_add('person #' . $person->id . 'has no email address, aborting');
return null;
}
} catch (midcom_error $e) {
} catch (midcom_error) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/calendar/event/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function verify_can_reserve() : bool
}
try {
$resource = org_openpsa_calendar_resource_dba::get_cached($this->resource);
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("Cannot fetch resource #{$this->resource} returning false", MIDCOM_LOG_INFO);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/contacts/handler/duplicates.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function load_next()
try {
$object1 = $this->load($param->parentguid);
$object2 = $this->load($param->name);
} catch (midcom_error $e) {
} catch (midcom_error) {
$i++;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/directmarketing/handler/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private function process_member(org_openpsa_directmarketing_campaign_member_dba
$row['organization_member'] = $membership;
try {
$row['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid);
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/directmarketing/handler/message/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private function _get_link_data($segmentation_param)
try {
$person = org_openpsa_contacts_person_dba::get_cached($link->person);
$segment = $person->get_parameter('org.openpsa.directmarketing.segments', $segmentation_param);
} catch (midcom_error $e) {
} catch (midcom_error) {
}
if (empty($segment)) {
$segment = $this->_l10n->get('no segment');
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/directmarketing/handler/subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function _handler_list(Request $request, string $person)
// Add person to campaign
try {
$campaign = new org_openpsa_directmarketing_campaign_dba($add_to);
} catch (midcom_error $e) {
} catch (midcom_error) {
// FIXME: More informative error message
$this->notify('Failed adding person %s to campaign %s', $add_to, 'error');
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/directmarketing/midcom/interfaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function background_update_campaign_members(array $args, midcom_baseclass
$stat = true;
try {
$campaign = new org_openpsa_directmarketing_campaign_dba($args['campaign_guid']);
} catch (midcom_error $e) {
} catch (midcom_error) {
$handler->print_error("{$args['campaign_guid']} is not a valid campaign GUID");
$stat = false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/directmarketing/sender.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function _get_person(org_openpsa_directmarketing_campaign_member_dba $me
{
try {
$person = org_openpsa_contacts_person_dba::get_cached($member->person);
} catch (midcom_error $e) {
} catch (midcom_error) {
debug_add("Person #{$member->person} deleted or missing, removing member (member #{$member->id})");
$member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED;
$member->delete();
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/documents/elFinderVolumeOpenpsa.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ protected function _unlink($path)
try {
$doc = new org_openpsa_documents_document_dba($path);
return $doc->delete();
} catch (midcom_error $e) {
} catch (midcom_error) {
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/org/openpsa/expenses/handler/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function _get_sorted_reports(midcom_core_collector $hours_mc) : array
foreach ($hours as $guid => $row) {
try {
$task = org_openpsa_projects_task_dba::get_cached($row['task']);
} catch (midcom_error $e) {
} catch (midcom_error) {
// Task couldn't be loaded, probably because of ACL
continue;
}
Expand All @@ -116,7 +116,7 @@ private function _get_sorted_reports(midcom_core_collector $hours_mc) : array
$person_object = midcom_db_person::get_cached($row['person']);
$person_label = $this->_get_list_link($person_object->name, person_id: $row['person']);
$person_name = $person_object->name;
} catch (midcom_error $e) {
} catch (midcom_error) {
$person_label = $this->_l10n->get('no person');
$person_name = '';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/invoices/billing/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function get_contact()
{
try {
return new org_openpsa_contacts_person_dba($this->linkGuid);
} catch (midcom_error $e) {
} catch (midcom_error) {
try {
return new org_openpsa_contacts_group_dba($this->linkGuid);
} catch (midcom_error $e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/invoices/handler/invoice/crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function _handler_create(Request $request, ?string $company = null)
// We're creating invoice for chosen customer
try {
$this->customer = new org_openpsa_contacts_group_dba($company);
} catch (midcom_error $e) {
} catch (midcom_error) {
$contact = new org_openpsa_contacts_person_dba($company);
$this->contact_id = $contact->id;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/org/openpsa/invoices/handler/invoice/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use midcom\grid\grid;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\JsonResponse;
use midcom\grid\editor;

Expand Down Expand Up @@ -41,7 +40,7 @@ public function _handler_items(string $guid, array &$data)
if ($sales_url) {
$entry['deliverable'] = '<a href="' . $sales_url . 'deliverable/' . $deliverable->guid . '/">' . $entry['deliverable'] . '</a>';
}
} catch (midcom_error $e) {
} catch (midcom_error) {
$entry['deliverable'] = '';
}
try {
Expand All @@ -50,7 +49,7 @@ public function _handler_items(string $guid, array &$data)
if ($projects_url) {
$entry['task'] = '<a href="' . $projects_url . 'task/' . $task->guid . '/">' . $entry['task'] . '</a>';
}
} catch (midcom_error $e) {
} catch (midcom_error) {
$entry['task'] = '';
}

Expand Down
6 changes: 3 additions & 3 deletions lib/org/openpsa/invoices/handler/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function get_row(midcom_core_dbaobject $invoice) : array
$customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer);
$entry['customer'] = "<a href=\"{$this->router->generate('list_customer_all', ['guid' => $customer->guid])}\">" . $customer->get_label() . "</a>";
$entry['index_customer'] = $customer->get_label();
} catch (midcom_error $e) {
} catch (midcom_error) {
$entry['customer'] = '';
$entry['index_customer'] = '';
}
Expand All @@ -101,7 +101,7 @@ public function get_row(midcom_core_dbaobject $invoice) : array
$entry['contact'] = "<a href=\"{$this->router->generate('list_customer_all', ['guid' => $contact->guid])}\">" . $contact->get_label() . "</a>";
$entry['contact'] = $contact_widget->show_inline();
$entry['index_contact'] = $contact->get_label();
} catch (midcom_error $e) {
} catch (midcom_error) {
$entry['contact'] = '';
$entry['index_contact'] = '';
}
Expand Down Expand Up @@ -248,7 +248,7 @@ public function _handler_customer(string $guid, array &$data)
{
try {
$this->_customer = new org_openpsa_contacts_group_dba($guid);
} catch (midcom_error $e) {
} catch (midcom_error) {
$this->_customer = new org_openpsa_contacts_person_dba($guid);
}
$data['customer'] = $this->_customer;
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/invoices/handler/projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function _show_uninvoiced(string $handler_id, array &$data)
$customer = org_openpsa_contacts_group_dba::get_cached($customer_id);
$data['customer_label'] = $customer->official;
$data['disabled'] = '';
} catch (midcom_error $e) {
} catch (midcom_error) {
$data['customer_label'] = $this->_l10n->get('no customer');
$data['disabled'] = ' disabled="disabled"';
}
Expand Down
Loading

0 comments on commit cda971b

Please sign in to comment.