Created
February 10, 2017 07:08
-
-
Save krystianbuczak/c3914611a4fa1afdd5c9a7cd41c98380 to your computer and use it in GitHub Desktop.
Simple Drupal 7 script that removes aliases with empty source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use this simple script in empty aliases sitaution, when you have many rows | |
// in "url_alias" table with "source" column being empty. | |
$query = db_select('url_alias', 'ua')->fields('ua'); | |
$query->condition('ua.source', '', '='); | |
//$query->range(0, 500); // uncomment if plan to do this job in smaller chunks | |
$paths = $query->execute()->fetchAll(); | |
foreach($paths as $object) { | |
if (is_numeric($object->pid)) { | |
path_delete($object->pid); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment