Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/189837
Change subject: Remove obvious function-level profiling
......................................................................
Remove obvious function-level profiling
Change-Id: I83b8ba27b3eab790d85cf8a7ed322047d1b82d12
---
M EducationProgram.hooks.php
M includes/Events/EditEventCreator.php
M includes/UPCUserCourseFinder.php
M includes/specials/SpecialEducationProgram.php
4 files changed, 1 insertion(+), 35 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram
refs/changes/37/189837/1
diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php
index db23831..26469a1 100644
--- a/EducationProgram.hooks.php
+++ b/EducationProgram.hooks.php
@@ -142,7 +142,6 @@
* @return bool
*/
public static function onGetPreferences( User $user, array
&$preferences ) {
- wfProfileIn( __METHOD__ );
if ( Settings::get( 'enableTopLink' ) ) {
$preferences['ep_showtoplink'] = array(
'type' => 'toggle',
@@ -167,7 +166,6 @@
);
}
- wfProfileOut( __METHOD__ );
return true;
}
@@ -235,7 +233,6 @@
* @return bool
*/
public static function onSpecialPageTabs( SkinTemplate &$sktemplate,
array &$links ) {
- wfProfileIn( __METHOD__ );
$textParts = \SpecialPageFactory::resolveAlias(
$sktemplate->getTitle()->getText() );
if ( in_array( $textParts[0], array( 'Enroll', 'Disenroll' ) )
@@ -259,7 +256,6 @@
}
}
- wfProfileOut( __METHOD__ );
return false;
}
@@ -273,8 +269,6 @@
* @param Title $title
*/
protected static function displayTabs( SkinTemplate &$sktemplate, array
&$links, Title $title ) {
- wfProfileIn( __METHOD__ );
-
if ( $title->getNamespace() == EP_NS ) {
$links['views'] = array();
$links['actions'] = array();
@@ -349,7 +343,6 @@
}
}
}
- wfProfileOut( __METHOD__ );
}
/**
@@ -364,8 +357,6 @@
* @return bool
*/
public static function onTitleIsAlwaysKnown( Title $title, &$isKnown ) {
- wfProfileIn( __METHOD__ );
-
if ( $title->getNamespace() == EP_NS ) {
if ( Utils::isCourse( $title ) ) {
$class = 'EducationProgram\Courses';
@@ -379,7 +370,6 @@
$isKnown = $class::singleton()->hasIdentifier(
$identifier );
}
- wfProfileOut( __METHOD__ );
return true;
}
@@ -451,8 +441,6 @@
* @return bool
*/
public static function onNewRevisionFromEditComplete( Page $article,
Revision $rev, $baseID, User $user ) {
- wfProfileIn( __METHOD__ );
-
$dbw = wfGetDB( DB_MASTER );
// TODO: properly inject dependencies
@@ -475,8 +463,6 @@
if ( $startOwnStransaction ) {
$dbw->commit();
}
-
- wfProfileOut( __METHOD__ );
return true;
}
diff --git a/includes/Events/EditEventCreator.php
b/includes/Events/EditEventCreator.php
index 56f06f6..60536ea 100644
--- a/includes/Events/EditEventCreator.php
+++ b/includes/Events/EditEventCreator.php
@@ -85,17 +85,13 @@
* @return Event[]
*/
public function getEventsForEdit( Page $article, Revision $rev, User
$user ) {
- wfProfileIn( __METHOD__ );
-
if ( !$user->isLoggedIn() ) {
- wfProfileOut( __METHOD__ );
return array();
}
$namespace = $article->getTitle()->getNamespace();
if ( !in_array( $namespace, array( NS_MAIN, NS_TALK, NS_USER,
NS_USER_TALK ) ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
@@ -109,8 +105,6 @@
$this->updateLastActive( $namespace, $user );
}
-
- wfProfileOut( __METHOD__ );
return $events;
}
@@ -194,8 +188,6 @@
* @param User $user
*/
protected function updateLastActive( $namespace, User $user ) {
- wfProfileIn( __METHOD__ );
-
if ( in_array( $namespace, array( NS_MAIN, NS_TALK ) ) ) {
$student = Student::newFromUserId( $user->getId(), true
);
@@ -207,8 +199,5 @@
$student->save();
}
}
-
- wfProfileOut( __METHOD__ );
}
-
}
diff --git a/includes/UPCUserCourseFinder.php b/includes/UPCUserCourseFinder.php
index ea6f0a5..3ee0cda 100644
--- a/includes/UPCUserCourseFinder.php
+++ b/includes/UPCUserCourseFinder.php
@@ -65,8 +65,6 @@
* @return int[]
*/
public function getCoursesForUsers( $userIds, $roles = array() ) {
- wfProfileIn( __METHOD__ );
-
$userIds = (array)$userIds;
$roles = (array)$roles;
@@ -99,8 +97,6 @@
foreach ( $upcRows as $upcRow ) {
$courseIds[] = (int)$upcRow->upc_course_id;
}
-
- wfProfileOut( __METHOD__ );
return $courseIds;
}
diff --git a/includes/specials/SpecialEducationProgram.php
b/includes/specials/SpecialEducationProgram.php
index 7a70b50..8a9c592 100644
--- a/includes/specials/SpecialEducationProgram.php
+++ b/includes/specials/SpecialEducationProgram.php
@@ -84,7 +84,6 @@
}
protected function getSummaryInfo() {
- wfProfileIn( __METHOD__ );
$data = array();
$data['org-count'] = Orgs::singleton()->count();
@@ -109,7 +108,6 @@
$number = $lang->formatNum( $number );
}
- wfProfileOut( __METHOD__ );
return $data;
}
@@ -252,7 +250,6 @@
* @return array
*/
protected function getTermData() {
- wfProfileIn( __METHOD__ );
$termNames = Courses::singleton()->selectFields( 'term',
array(), array( 'DISTINCT' ) );
$terms = array();
$byGender = array();
@@ -301,7 +298,6 @@
$byGender[$termName] = $this->getByGender( $students,
$oas, $cas, $instructors );
}
- wfProfileOut( __METHOD__ );
return array( 'terms' => $terms, 'bygender' => $byGender );
}
@@ -318,7 +314,6 @@
* @return array
*/
protected function getByGender( array $students, array $oas, array
$cas, array $instructors ) {
- wfProfileIn( __METHOD__ );
$genders = $this->getGenders( array_unique( array_merge(
$students, $oas, $cas, $instructors ) ) );
$result = array(
@@ -327,7 +322,7 @@
'cas' => $this->getGenderDistribution( $cas, $genders ),
'instructors' => $this->getGenderDistribution(
$instructors, $genders ),
);
- wfProfileOut( __METHOD__ );
+
return $result;
}
--
To view, visit https://gerrit.wikimedia.org/r/189837
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I83b8ba27b3eab790d85cf8a7ed322047d1b82d12
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits