当前位置: 首页>>代码示例>>PHP>>正文


PHP Stats::insert方法代码示例

本文整理汇总了PHP中Stats::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::insert方法的具体用法?PHP Stats::insert怎么用?PHP Stats::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stats的用法示例。


在下文中一共展示了Stats::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: str_replace

 // STUPID IE
 $media_name = str_replace(array('?', '/', '\\'), "_", $media->f_file);
 $browser->downloadHeaders($media_name, $media->mime, false, $media->size);
 $fp = fopen(Core::conv_lc_file($media->file), 'rb');
 $bytesStreamed = 0;
 if (!is_resource($fp)) {
     debug_event('Play', "Error: Unable to open {$media->file} for downloading", '2');
     exit;
 }
 if (!$share_id) {
     if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
         debug_event('play', 'Registering download stats for {' . $media->get_stream_name() . '}...', '5');
         $sessionkey = $sid ?: Stream::get_session();
         $agent = Session::agent($sessionkey);
         $location = Session::get_geolocation($sessionkey);
         Stats::insert($type, $media->id, $uid, $agent, $location, 'download');
     }
 }
 // Check to see if we should be throttling because we can get away with it
 if (AmpConfig::get('rate_limit') > 0) {
     while (!feof($fp)) {
         echo fread($fp, round(AmpConfig::get('rate_limit') * 1024));
         $bytesStreamed += round(AmpConfig::get('rate_limit') * 1024);
         flush();
         sleep(1);
     }
 } else {
     fpassthru($fp);
 }
 fclose($fp);
 exit;
开发者ID:ivan801,项目名称:ampache,代码行数:31,代码来源:index.php

示例2: set_played

 /**
  * set_played
  * this checks to see if the current object has been played
  * if not then it sets it to played. In any case it updates stats.
  * @param int $user
  * @param string $agent
  * @param array $location
  * @return boolean
  */
 public function set_played($user, $agent, $location)
 {
     Stats::insert('podcast', $this->podcast, $user, $agent, $location);
     Stats::insert('podcast_episode', $this->id, $user, $agent, $location);
     if ($this->played) {
         return true;
     }
     /* If it hasn't been played, set it! */
     Podcast_Episode::update_played(true, $this->id);
     return true;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:20,代码来源:podcast_episode.class.php

示例3: set_played

 /**
  * set_played
  * this checks to see if the current object has been played
  * if not then it sets it to played. In any case it updates stats.
  * @param int $user
  * @param string $agent
  * @param array $location
  * @return boolean
  */
 public function set_played($user, $agent, $location)
 {
     Stats::insert('song', $this->id, $user, $agent, $location);
     Stats::insert('album', $this->album, $user, $agent, $location);
     Stats::insert('artist', $this->artist, $user, $agent, $location);
     if ($this->played) {
         return true;
     }
     /* If it hasn't been played, set it! */
     self::update_played(true, $this->id);
     return true;
 }
开发者ID:nioc,项目名称:ampache,代码行数:21,代码来源:song.class.php

示例4: set_played

 /**
  * set_played
  * this checks to see if the current object has been played
  * if not then it sets it to played. In any case it updates stats.
  * @param int $user
  * @param string $agent
  * @param array $location
  * @return boolean
  */
 public function set_played($user, $agent, $location)
 {
     Stats::insert('video', $this->id, $user, $agent, $location);
     if ($this->played) {
         return true;
     }
     /* If it hasn't been played, set it! */
     Video::update_played(true, $this->id);
     return true;
 }
开发者ID:ivan801,项目名称:ampache,代码行数:19,代码来源:video.class.php

示例5: update_stats

 /**
  * update_user_stats
  * updates the playcount mojo for this specific user
  */
 public function update_stats($song_id, $agent = '')
 {
     debug_event('user.class.php', 'Updating stats for {' . $song_id . '} {' . $agent . '}...', '5');
     $song_info = new Song($song_id);
     $song_info->format();
     $user = $this->id;
     if (!strlen($song_info->file)) {
         return false;
     }
     $this->set_preferences();
     // If pthreads available, we call save_songplay in a new thread to quickly return
     if (class_exists("Thread", false)) {
         debug_event('user.class.php', 'Calling save_songplay plugins in a new thread...', '5');
         $thread = new scrobbler_async($GLOBALS['user'], $song_info);
         if ($thread->start()) {
             //$thread->join();
         } else {
             debug_event('user.class.php', 'Error when starting the thread.', '1');
         }
     } else {
         User::save_songplay($GLOBALS['user'], $song_info);
     }
     // Do this last so the 'last played checks are correct'
     Stats::insert('song', $song_id, $user, $agent);
     Stats::insert('album', $song_info->album, $user, $agent);
     Stats::insert('artist', $song_info->artist, $user, $agent);
     return true;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:32,代码来源:user.class.php


注:本文中的Stats::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。