]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorEvan Prodromou <evan@status.net>
Mon, 25 Jan 2010 23:10:59 +0000 (18:10 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 25 Jan 2010 23:10:59 +0000 (18:10 -0500)
1  2 
actions/apistatusesupdate.php
classes/Memcached_DataObject.php
lib/default.php
lib/iomaster.php
lib/queuemanager.php
lib/util.php

index f8bf7cf874d0a811b2e600030cd57d4f173b4d19,9d831b9dbbc42c855dec90813c04861b0acd9029..31c9b20ce2783774927ab0f212e80627cd685eeb
@@@ -85,11 -85,6 +85,11 @@@ class ApiStatusesUpdateAction extends A
          $this->lat    = $this->trimmed('lat');
          $this->lon    = $this->trimmed('long');
  
 +        // try to set the source attr from OAuth app
 +        if (empty($this->source)) {
 +            $this->source = $this->oauth_source;
 +        }
 +
          if (empty($this->source) || in_array($this->source, self::$reserved_sources)) {
              $this->source = 'api';
          }
                  $upload->attachToNotice($this->notice);
              }
  
-             common_broadcast_notice($this->notice);
          }
  
          $this->showNotice();
index 33645a3e8b6eeaf75246d69e87f70db41ab209a7,2c9dcf59539784d0123503405b63287dd02abd01..43610dddbbf39cac81005afc39aa994948108ce0
@@@ -313,39 -313,6 +313,39 @@@ class Memcached_DataObject extends DB_D
          return new ArrayWrapper($cached);
      }
  
 +    /**
 +     * sends query to database - this is the private one that must work 
 +     *   - internal functions use this rather than $this->query()
 +     *
 +     * Overridden to do logging.
 +     *
 +     * @param  string  $string
 +     * @access private
 +     * @return mixed none or PEAR_Error
 +     */
 +    function _query($string)
 +    {
 +        $start = microtime(true);
 +        $result = parent::_query($string);
 +        $delta = microtime(true) - $start;
 +
 +        $limit = common_config('db', 'log_slow_queries');
 +        if (($limit > 0 && $delta >= $limit) || common_config('db', 'log_queries')) {
 +            $clean = $this->sanitizeQuery($string);
 +            common_log(LOG_DEBUG, sprintf("DB query (%0.3fs): %s", $delta, $clean));
 +        }
 +        return $result;
 +    }
 +
 +    // Sanitize a query for logging
 +    // @fixme don't trim spaces in string literals
 +    function sanitizeQuery($string)
 +    {
 +        $string = preg_replace('/\s+/', ' ', $string);
 +        $string = trim($string);
 +        return $string;
 +    }
 +
      // We overload so that 'SET NAMES "utf8"' is called for
      // each connection
  
  
          return $dsn;
      }
+     static function blow()
+     {
+         $c = self::memcache();
+         if (empty($c)) {
+             return false;
+         }
+         $args = func_get_args();
+         $format = array_shift($args);
+         $keyPart = vsprintf($format, $args);
+         $cacheKey = common_cache_key($keyPart);
+         return $c->delete($cacheKey);
+     }
  }
diff --combined lib/default.php
index d258bbaf48ab402306f74ca9d49081b8491c1f7e,57199b356fa6034c5612263ef69006a7d89d1829..4f24a6d22e2e116d0bc058fe0e08fe8b9b00c79e
@@@ -30,6 -30,8 +30,8 @@@
  $default =
    array('site' =>
          array('name' => 'Just another StatusNet microblog',
+               'nickname' => 'statusnet',
+               'wildcard' => null,
                'server' => $_server,
                'theme' => 'default',
                'path' => $_path,
@@@ -67,9 -69,7 +69,9 @@@
                'db_driver' => 'DB', # XXX: JanRain libs only work with DB
                'quote_identifiers' => false,
                'type' => 'mysql',
 -              'schemacheck' => 'runtime'), // 'runtime' or 'script'
 +              'schemacheck' => 'runtime', // 'runtime' or 'script'
 +              'log_queries' => false, // true to log all DB queries
 +              'log_slow_queries' => 0), // if set, log queries taking over N seconds
          'syslog' =>
          array('appname' => 'statusnet', # for syslog
                'priority' => 'debug', # XXX: currently ignored
                'uploads' => true,
                'filecommand' => '/usr/bin/file',
                ),
 +        'application' =>
 +        array('desclimit' => null),
          'group' =>
          array('maxaliases' => 3,
                'desclimit' => null),
                                   'Mapstraction' => null,
                                   'Linkback' => null,
                                   'WikiHashtags' => null,
 +                                 'PubSubHubBub' => null,
 +                                 'RSSCloud' => null,
                                   'OpenID' => null),
                ),
          'admin' =>
diff --combined lib/iomaster.php
index 29bd677bd448457fc115eee40b492f352363dab7,3bf82bc6b47903b76fc42631ddb1fdbc4014a0aa..94abdeefcc28b7f3e8a8cf19ef7607c154dec0f9
@@@ -88,7 -88,7 +88,7 @@@ abstract class IoMaste
          $sn = new Status_network();
          $sn->find();
          while ($sn->fetch()) {
-             $hosts[] = $sn->hostname;
+             $hosts[] = $sn->getServerName();
          }
          return $hosts;
      }
       */
      protected function instantiate($class)
      {
 -        if (isset($this->singletons[$class])) {
 +        if (is_string($class) && isset($this->singletons[$class])) {
              // Already instantiated a multi-site-capable handler.
              // Just let it know it should listen to this site too!
              $this->singletons[$class]->addSite(common_config('site', 'server'));
      
      protected function getManager($class)
      {
 -        return call_user_func(array($class, 'get'));
 +        if(is_object($class)){
 +            return $class;
 +        } else {
 +            return call_user_func(array($class, 'get'));
 +        }
      }
  
      /**
       * for per-queue and per-site records.
       *
       * @param string $key counter name
 -     * @param array $owners list of owner keys like 'queue:jabber' or 'site:stat01'
 +     * @param array $owners list of owner keys like 'queue:xmpp' or 'site:stat01'
       */
      public function stats($key, $owners=array())
      {
diff --combined lib/queuemanager.php
index b2e86b127ec9efdb9e04eb31594420f09766d079,e5cf8239e9cb1ee49dd5681032995b20a8eaa412..0063ed5f3955e6609e17363f7ded30db5f91dab4
@@@ -181,9 -181,7 +181,9 @@@ abstract class QueueManager extends IoM
      {
          if (isset($this->handlers[$queue])) {
              $class = $this->handlers[$queue];
 -            if (class_exists($class)) {
 +            if(is_object($class)) {
 +                return $class;
 +            } else if (class_exists($class)) {
                  return new $class();
              } else {
                  common_log(LOG_ERR, "Nonexistent handler class '$class' for queue '$queue'");
              $this->connect('plugin', 'PluginQueueHandler');
              $this->connect('omb', 'OmbQueueHandler');
              $this->connect('ping', 'PingQueueHandler');
+             $this->connect('distrib', 'DistribQueueHandler');
              if (common_config('sms', 'enabled')) {
                  $this->connect('sms', 'SmsQueueHandler');
              }
              // XMPP output handlers...
              $this->connect('jabber', 'JabberQueueHandler');
              $this->connect('public', 'PublicQueueHandler');
-             
              // @fixme this should get an actual queue
              //$this->connect('confirm', 'XmppConfirmHandler');
  
       * Only registered transports will be reliably picked up!
       *
       * @param string $transport
 -     * @param string $class
 +     * @param string $class class name or object instance
       * @param string $group
       */
      public function connect($transport, $class, $group='queuedaemon')
diff --combined lib/util.php
index 01b159ac1596cf5abecd33a5a0b566ca48db4c50,4312f9876b36ecf1916a972b9985d093909c6c5b..6c9f6316ada31e05d3614be35ce5a3c677f995a0
@@@ -596,13 -596,20 +596,13 @@@ function common_linkify($url) 
      }
  
      if (!empty($f)) {
 -        if ($f->isEnclosure()) {
 +        if ($f->getEnclosure()) {
              $is_attachment = true;
              $attachment_id = $f->id;
 -        } else {
 -            $foe = File_oembed::staticGet('file_id', $f->id);
 -            if (!empty($foe)) {
 -                // if it has OEmbed info, it's an attachment, too
 -                $is_attachment = true;
 -                $attachment_id = $f->id;
 -
 -                $thumb = File_thumbnail::staticGet('file_id', $f->id);
 -                if (!empty($thumb)) {
 -                    $has_thumb = true;
 -                }
 +
 +            $thumb = File_thumbnail::staticGet('file_id', $f->id);
 +            if (!empty($thumb)) {
 +                $has_thumb = true;
              }
          }
      }
@@@ -980,7 -987,7 +980,7 @@@ function common_redirect($url, $code=30
  
  function common_broadcast_notice($notice, $remote=false)
  {
-     return common_enqueue_notice($notice);
+     // DO NOTHING!
  }
  
  // Stick the notice on the queue