Nik has submitted this change and it was merged.
Change subject: Added namespace to Publisher library.
......................................................................
Added namespace to Publisher library.
Change-Id: I034123b9ffd343eebbe994f63cb2ead0ae5b8bd1
---
M PubSubHubbub.php
R lib/Publisher.php
2 files changed, 12 insertions(+), 10 deletions(-)
Approvals:
Nik: Verified; Looks good to me, approved
diff --git a/PubSubHubbub.php b/PubSubHubbub.php
index 514d169..d6ff9b9 100644
--- a/PubSubHubbub.php
+++ b/PubSubHubbub.php
@@ -47,7 +47,7 @@
$wgAutoloadClasses['PubSubHubbub\\PubSubHubbub'] = $dir .
'PubSubHubbub.body.php';
$wgAutoloadClasses['PubSubHubbub\\PublishChangesJob'] = $dir .
'PublishChangesJob.php';
-$wgAutoloadClasses['PubSubHubbub\\Publisher'] = $dir . 'lib/publisher.php';
+$wgAutoloadClasses['PubSubHubbub\\Publisher'] = $dir . 'lib/Publisher.php';
$wgHooks['PageContentSaveComplete'][] =
'PubSubHubbub\\PubSubHubbub::onPageContentSaveComplete';
$wgHooks['RawPageViewBeforeOutput'][] =
'PubSubHubbub\\PubSubHubbub::onRawPageViewBeforeOutput';
diff --git a/lib/publisher.php b/lib/Publisher.php
similarity index 87%
rename from lib/publisher.php
rename to lib/Publisher.php
index c90baec..e4a4560 100644
--- a/lib/publisher.php
+++ b/lib/Publisher.php
@@ -22,6 +22,8 @@
* @file
*/
+namespace PubSubHubbub;
+
/**
* A publisher client library for PubSubHubbub.
*
@@ -48,10 +50,10 @@
*/
public function __construct ( $hub_url ) {
if ( !isset ( $hub_url ) )
- throw new Exception ( "Please specify a hub url" );
+ throw new \Exception ( "Please specify a hub url" );
if ( !preg_match ( "|^https?://|i" , $hub_url ) )
- throw new Exception ( "The specified hub url does not
appear to be valid: " . $hub_url );
+ throw new \Exception ( "The specified hub url does not
appear to be valid: " . $hub_url );
$this->hub_url = $hub_url;
}
@@ -64,7 +66,7 @@
*/
public function publish_update ( $topic_urls, $http_function = false ) {
if ( !isset ( $topic_urls ) )
- throw new Exception ( "Please specify a topic URL" );
+ throw new \Exception ( "Please specify a topic URL" );
// Check that we're working with an array
if ( !is_array ( $topic_urls ) ) {
@@ -78,7 +80,7 @@
// Lightweight check that we're actually working with a
valid url
if ( !preg_match ( "|^https?://|i", $topic_url ) )
- throw new Exception ( "The specified topic URL
does not appear to be valid: " . $topic_url );
+ throw new \Exception ( "The specified topic URL
does not appear to be valid: " . $topic_url );
// Append the topic URL parameters
$post_string .= "&hub.url=" . urlencode ($topic_url );
@@ -114,14 +116,14 @@
CURLOPT_USERAGENT =>
"MediaWiki-PubSubHubbub-Publisher/1.0"
);
- $ch = curl_init ();
- curl_setopt_array ( $ch, $options );
+ $ch = \curl_init ();
+ \curl_setopt_array ( $ch, $options );
- $response = curl_exec ( $ch );
+ $response = \curl_exec ( $ch );
$this->last_response = $response;
- $info = curl_getinfo ( $ch );
+ $info = \curl_getinfo ( $ch );
- curl_close ( $ch );
+ \curl_close ( $ch );
// All good
if ( $info['http_code'] == 204 )
--
To view, visit https://gerrit.wikimedia.org/r/123224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I034123b9ffd343eebbe994f63cb2ead0ae5b8bd1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PubSubHubbub
Gerrit-Branch: master
Gerrit-Owner: Nik <[email protected]>
Gerrit-Reviewer: Nik <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits