/** * Find pages in main and talk namespaces that have a prefix of the new * namespace so we know titles that will need migrating * * @param int $ns Destination namespace id * @param string $name Prefix that is being made a namespace * @param array $options Associative array of validated command-line options * * @return ResultWrapper */ private function getTargetList($ns, $name, $options) { if ($options['move-talk'] && MWNamespace::isSubject($ns)) { $checkNamespaces = [NS_MAIN, NS_TALK]; } else { $checkNamespaces = NS_MAIN; } return $this->db->select('page', ['page_id', 'page_title', 'page_namespace'], ['page_namespace' => $checkNamespaces, 'page_title' . $this->db->buildLike("{$name}:", $this->db->anyString())], __METHOD__); }
/** * @param Database $dbw * @return array */ function getConditions($dbw) { $conds = []; $end = $this->getOption('end', false); $mime = $this->getOption('mime', false); $mediatype = $this->getOption('mediatype', false); $like = $this->getOption('metadata-contains', false); if ($end !== false) { $conds[] = 'img_name <= ' . $dbw->addQuotes($end); } if ($mime !== false) { list($major, $minor) = File::splitMime($mime); $conds['img_major_mime'] = $major; if ($minor !== '*') { $conds['img_minor_mime'] = $minor; } } if ($mediatype !== false) { $conds['img_media_type'] = $mediatype; } if ($like) { $conds[] = 'img_metadata ' . $dbw->buildLike($dbw->anyString(), $like, $dbw->anyString()); } return $conds; }