$lastPage = null;
foreach ( $result as $row ) {
if ( $lastPage != $row->page_id ) {
- if ( isset( $lastPage ) ) {
+ if ( $lastPage !== null ) {
$this->output( "\n" );
}
$page = Title::makeTitle( $row->page_namespace, $row->page_title );
$link = Title::makeTitle( $row->pl_namespace, $row->pl_title );
$this->output( " " . $link->getPrefixedURL() );
}
- if ( isset( $lastPage ) ) {
+ if ( $lastPage !== null ) {
$this->output( "\n" );
}
}
public function execute() {
$async = $this->getOption( 'async', false );
$dryrun = $this->getOption( 'dry-run', false );
- $title = $this->getOption( 'title' );
- if ( isset( $title ) ) {
- $title = Title::newFromText( $title );
+ if ( $this->hasOption( 'title' ) ) {
+ $title = Title::newFromText( $this->getOption( 'title' ) );
if ( !$title || !$title->isRedirect() ) {
$this->error( $title->getPrefixedText() . " is not a redirect!\n", true );
}
+ } else {
+ $title = null;
}
$dbr = wfGetDB( DB_SLAVE );
'pb.page_is_redirect' => 1,
);
- if ( isset( $title ) ) {
+ if ( $title != null ) {
$conds['pb.page_namespace'] = $title->getNamespace();
$conds['pb.page_title'] = $title->getDBkey();
}
* @return null|string
*/
private static function init_path( $fspath ) {
- if ( !isset( $fspath ) ) {
- return null;
- }
# Create directory if needed
if ( $fspath && !is_dir( $fspath ) ) {
wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" );