* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance
*/
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
+/**
+ * Maintenance script that sends purge requests for listed pages to squid.
+ *
+ * @ingroup Maintenance
+ */
class PurgeList extends Maintenance {
public function __construct() {
parent::__construct();
while ( !feof( $stdin ) ) {
$page = trim( fgets( $stdin ) );
- if ( substr( $page, 0, 7 ) == 'http://' ) {
+ if ( preg_match( '%^https?://%', $page ) ) {
$urls[] = $page;
} elseif ( $page !== '' ) {
$title = Title::newFromText( $page );
if ( $title ) {
- $url = $title->getFullUrl();
+ $url = $title->getInternalUrl();
$this->output( "$url\n" );
$urls[] = $url;
if ( $this->getOption( 'purge' ) ) {
$urls = array();
foreach( $result as $row ) {
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
- $url = $title->getFullUrl();
+ $url = $title->getInternalUrl();
$urls[] = $url;
}