[MediaWiki-commits] [Gerrit] wikimedia...drupal[master]: Re-apply WMF patches

2016-12-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Re-apply WMF patches
..


Re-apply WMF patches

Note I have rolled the following into one patch. I had to fix conflicts on the
98f9e6b (FR #1070) patch on includes/registry.inc

debfcf6 Use sans-serifs for Civi's sake
98f9e6b (FR #1070) Drupal registry supports namespaces
89c75c5 Accept anything callable as a callback, need not be a global function 
name.
e91344f WIP fixes for testing

Change-Id: I4220bfd37a587acf07942e4f94d416908aafcdbe
---
M includes/form.inc
M includes/registry.inc
M modules/system/system.info
A modules/system/tests/NamespacedClass.php
M modules/user/user.module
M themes/bartik/css/style.css
6 files changed, 19 insertions(+), 4 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/form.inc b/includes/form.inc
index 130775f..835b117 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -789,7 +789,7 @@
 
   // We first check to see if there's a function named after the $form_id.
   // If there is, we simply pass the arguments on to it to get the form.
-  if (!function_exists($form_id)) {
+  if (!is_callable($form_id)) {
 // In cases where many form_ids need to share a central constructor 
function,
 // such as the node editing form, modules can implement hook_forms(). It
 // maps one or more form_ids to the correct constructor functions.
diff --git a/includes/registry.inc b/includes/registry.inc
index 29a1fca..67c7a4c 100644
--- a/includes/registry.inc
+++ b/includes/registry.inc
@@ -164,8 +164,14 @@
  *   (optional) Weight of the module.
  */
 function _registry_parse_file($filename, $contents, $module = '', $weight = 0) 
{
+  $namespace = '';
+  // We support one namespace per file
+  if 
(preg_match('/^<\?(?:php)?\s*(?:declare[^;]+;\s*)?namespace\s+?([a-zA-Z0-9_]+)/ms',
 $contents, $matches)) {
+$namespace = $matches[1] . '\\';
+  }
   if 
(preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface|trait)\s+([a-zA-Z0-9_]+)/m',
 $contents, $matches)) {
-foreach ($matches[2] as $key => $name) {
+foreach ($matches[2] as $key => &$name) {
+  $name = $namespace . $name;
   db_merge('registry')
 ->key(array(
   'name' => $name,
diff --git a/modules/system/system.info b/modules/system/system.info
index 3653157..8241d4c 100644
--- a/modules/system/system.info
+++ b/modules/system/system.info
@@ -9,6 +9,7 @@
 files[] = system.tar.inc
 files[] = system.updater.inc
 files[] = system.test
+files[] = tests/NamespacedClass.php
 required = TRUE
 configure = admin/config/system
 
diff --git a/modules/system/tests/NamespacedClass.php 
b/modules/system/tests/NamespacedClass.php
new file mode 100644
index 000..b27aedb
--- /dev/null
+++ b/modules/system/tests/NamespacedClass.php
@@ -0,0 +1,4 @@
+uid == 1) {
 return TRUE;
@@ -1570,7 +1574,7 @@
  *   TRUE if the user is logged in, FALSE if the user is anonymous.
  */
 function user_is_logged_in() {
-  return (bool) $GLOBALS['user']->uid;
+  return $GLOBALS['user'] && (bool) $GLOBALS['user']->uid;
 }
 
 /**
diff --git a/themes/bartik/css/style.css b/themes/bartik/css/style.css
index 8426e56..80d8a5c 100644
--- a/themes/bartik/css/style.css
+++ b/themes/bartik/css/style.css
@@ -106,7 +106,7 @@
 #site-slogan,
 .ui-widget,
 .comment-form label {
-  font-family: Georgia, "Times New Roman", Times, serif;
+  font-family: Helvetica, Arial, sans-serif;
 }
 #header,
 #footer-wrapper,

-- 
To view, visit https://gerrit.wikimedia.org/r/322823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4220bfd37a587acf07942e4f94d416908aafcdbe
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm/drupal
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...drupal[master]: Re-apply WMF patches

2016-11-21 Thread Eileen (Code Review)
Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/322823

Change subject: Re-apply WMF patches
..

Re-apply WMF patches

Note I have rolled the following into one patch. I had to fix conflicts on the
98f9e6b (FR #1070) patch on includes/registry.inc

debfcf6 Use sans-serifs for Civi's sake
98f9e6b (FR #1070) Drupal registry supports namespaces
89c75c5 Accept anything callable as a callback, need not be a global function 
name.
e91344f WIP fixes for testing

Change-Id: I4220bfd37a587acf07942e4f94d416908aafcdbe
---
M includes/form.inc
M includes/registry.inc
M modules/system/system.info
A modules/system/tests/NamespacedClass.php
M modules/user/user.module
M themes/bartik/css/style.css
6 files changed, 21 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/drupal 
refs/changes/23/322823/1

diff --git a/includes/form.inc b/includes/form.inc
index 130775f..835b117 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -789,7 +789,7 @@
 
   // We first check to see if there's a function named after the $form_id.
   // If there is, we simply pass the arguments on to it to get the form.
-  if (!function_exists($form_id)) {
+  if (!is_callable($form_id)) {
 // In cases where many form_ids need to share a central constructor 
function,
 // such as the node editing form, modules can implement hook_forms(). It
 // maps one or more form_ids to the correct constructor functions.
diff --git a/includes/registry.inc b/includes/registry.inc
index 29a1fca..515fbce 100644
--- a/includes/registry.inc
+++ b/includes/registry.inc
@@ -164,8 +164,15 @@
  *   (optional) Weight of the module.
  */
 function _registry_parse_file($filename, $contents, $module = '', $weight = 0) 
{
-  if 
(preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface|trait)\s+([a-zA-Z0-9_]+)/m',
 $contents, $matches)) {
-foreach ($matches[2] as $key => $name) {
+  $namespace = '';
+  // We support one namespace per file
+  if 
(preg_match('/^<\?(?:php)?\s*(?:declare[^;]+;\s*)?namespace\s+?([a-zA-Z0-9_]+)/ms',
 $contents, $matches)) {
+$namespace = $matches[1] . '\\';
+  }
+  if 
(preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface|trait)\s+([a-zA-Z0-9_]+)/m',
 $contents, $matches))
+  if 
(preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface)\s+([a-zA-Z0-9_]+)/m',
 $contents, $matches)) {
+foreach ($matches[2] as $key => &$name) {
+  $name = $namespace . $name;
   db_merge('registry')
 ->key(array(
   'name' => $name,
diff --git a/modules/system/system.info b/modules/system/system.info
index 3653157..8241d4c 100644
--- a/modules/system/system.info
+++ b/modules/system/system.info
@@ -9,6 +9,7 @@
 files[] = system.tar.inc
 files[] = system.updater.inc
 files[] = system.test
+files[] = tests/NamespacedClass.php
 required = TRUE
 configure = admin/config/system
 
diff --git a/modules/system/tests/NamespacedClass.php 
b/modules/system/tests/NamespacedClass.php
new file mode 100644
index 000..b27aedb
--- /dev/null
+++ b/modules/system/tests/NamespacedClass.php
@@ -0,0 +1,4 @@
+uid == 1) {
 return TRUE;
@@ -1570,7 +1574,7 @@
  *   TRUE if the user is logged in, FALSE if the user is anonymous.
  */
 function user_is_logged_in() {
-  return (bool) $GLOBALS['user']->uid;
+  return $GLOBALS['user'] && (bool) $GLOBALS['user']->uid;
 }
 
 /**
diff --git a/themes/bartik/css/style.css b/themes/bartik/css/style.css
index 8426e56..80d8a5c 100644
--- a/themes/bartik/css/style.css
+++ b/themes/bartik/css/style.css
@@ -106,7 +106,7 @@
 #site-slogan,
 .ui-widget,
 .comment-form label {
-  font-family: Georgia, "Times New Roman", Times, serif;
+  font-family: Helvetica, Arial, sans-serif;
 }
 #header,
 #footer-wrapper,

-- 
To view, visit https://gerrit.wikimedia.org/r/322823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4220bfd37a587acf07942e4f94d416908aafcdbe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/drupal
Gerrit-Branch: master
Gerrit-Owner: Eileen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits