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


PHP Song::update_year方法代码示例

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


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

示例1: update

 /**
  * update
  * This function takes a key'd array of data and updates this object
  * as needed
  */
 public function update($data)
 {
     $year = $data['year'];
     $artist = $data['artist'];
     $name = $data['name'];
     $disk = $data['disk'];
     $mbid = $data['mbid'];
     $current_id = $this->id;
     $updated = false;
     $songs = null;
     if ($artist != $this->artist_id and $artist) {
         // Update every song
         $songs = $this->get_songs();
         foreach ($songs as $song_id) {
             Song::update_artist($artist, $song_id);
         }
         $updated = true;
         Artist::gc();
     }
     $album_id = self::check($name, $year, $disk, $mbid);
     if ($album_id != $this->id) {
         if (!is_array($songs)) {
             $songs = $this->get_songs();
         }
         foreach ($songs as $song_id) {
             Song::update_album($album_id, $song_id);
             Song::update_year($year, $song_id);
         }
         $current_id = $album_id;
         $updated = true;
         self::gc();
     }
     if ($updated && is_array($songs)) {
         foreach ($songs as $song_id) {
             Song::update_utime($song_id);
         }
         // foreach song of album
         Stats::gc();
         Rating::gc();
         Userflag::gc();
     }
     // if updated
     $override_songs = false;
     if ($data['apply_childs'] == 'checked') {
         $override_songs = true;
     }
     $this->update_tags($data['edit_tags'], $override_songs, $current_id);
     return $current_id;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:54,代码来源:album.class.php

示例2: update

 /**
  * update
  * This function takes a key'd array of data and updates this object
  * as needed
  * @param array $data
  * @return int
  */
 public function update(array $data)
 {
     $year = isset($data['year']) ? $data['year'] : $this->year;
     $artist = isset($data['artist']) ? intval($data['artist']) : $this->artist_id;
     $album_artist = isset($data['album_artist']) ? intval($data['album_artist']) : $this->album_artist;
     $name = isset($data['name']) ? $data['name'] : $this->name;
     $disk = isset($data['disk']) ? $data['disk'] : $this->disk;
     $mbid = isset($data['mbid']) ? $data['mbid'] : $this->mbid;
     $mbid_group = isset($data['mbid_group']) ? $data['mbid_group'] : $this->mbid_group;
     $release_type = isset($data['release_type']) ? $data['release_type'] : $this->release_type;
     $current_id = $this->id;
     $updated = false;
     $songs = null;
     if ($artist != $this->artist_id && $artist) {
         // Update every song
         $songs = $this->get_songs();
         foreach ($songs as $song_id) {
             Song::update_artist($artist, $song_id);
         }
         $updated = true;
         Artist::gc();
     }
     if (!empty($data['album_artist_name'])) {
         // Need to create new artist according the name
         $album_artist = Artist::check($data['album_artist_name']);
     }
     $album_id = self::check($name, $year, $disk, $mbid, $mbid_group, $album_artist, $release_type);
     if ($album_id != $this->id) {
         if (!is_array($songs)) {
             $songs = $this->get_songs();
         }
         foreach ($songs as $song_id) {
             Song::update_album($album_id, $song_id);
             Song::update_year($year, $song_id);
             Song::write_id3_for_song($song_id);
         }
         $current_id = $album_id;
         $updated = true;
         Stats::migrate('album', $this->id, $album_id);
         Art::migrate('album', $this->id, $album_id);
         self::gc();
     } else {
         Album::update_year($year, $album_id);
         Album::update_mbid_group($mbid_group, $album_id);
         Album::update_release_type($release_type, $album_id);
     }
     $this->year = $year;
     $this->mbid_group = $mbid_group;
     $this->release_type = $release_type;
     $this->name = $name;
     $this->disk = $disk;
     $this->mbid = $mbid;
     $this->album_artist = $album_artist;
     if ($updated && is_array($songs)) {
         foreach ($songs as $song_id) {
             Song::update_utime($song_id);
         }
         // foreach song of album
         Stats::gc();
         Rating::gc();
         Userflag::gc();
         Useractivity::gc();
     }
     // if updated
     $override_childs = false;
     if ($data['overwrite_childs'] == 'checked') {
         $override_childs = true;
     }
     $add_to_childs = false;
     if ($data['add_to_childs'] == 'checked') {
         $add_to_childs = true;
     }
     if (isset($data['edit_tags'])) {
         $this->update_tags($data['edit_tags'], $override_childs, $add_to_childs, $current_id, true);
     }
     return $current_id;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:84,代码来源:album.class.php


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