Changeset 3423:e34ec8af1a67 for inc
- Timestamp:
- 11/26/16 11:53:12 (9 years ago)
- Branch:
- default
- Location:
- inc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.blog.php
r3340 r3423 832 832 'post_tz, post_creadt, post_upddt, post_format, post_password, '. 833 833 'post_url, post_lang, post_title, '.$content_req. 834 'post_type, post_meta, post_status, post_selected, post_position, '. 834 'post_type, post_meta, '. 835 'post_status, post_firstpub, post_selected, post_position, '. 835 836 'post_open_comment, post_open_tb, nb_comment, nb_trackback, '. 836 837 'U.user_name, U.user_firstname, U.user_displayname, U.user_email, '. … … 928 929 if (isset($params['post_status'])) { 929 930 $strReq .= 'AND post_status = '.(integer) $params['post_status'].' '; 931 } 932 933 if (isset($params['post_firstpub'])) { 934 $strReq .= 'AND post_firstpub = '.(integer) $params['post_firstpub'].' '; 930 935 } 931 936 … … 1319 1324 $this->triggerBlog(); 1320 1325 1326 $this->firstPublicationEntries($cur->post_id); 1327 1321 1328 return $cur->post_id; 1322 1329 } … … 1379 1386 1380 1387 $this->triggerBlog(); 1388 1389 $this->firstPublicationEntries($id); 1381 1390 } 1382 1391 … … 1423 1432 $cur->update($strReq); 1424 1433 $this->triggerBlog(); 1434 1435 $this->firstPublicationEntries($posts_ids); 1425 1436 } 1426 1437 … … 1628 1639 # --BEHAVIOR-- coreAfterScheduledEntriesPublish 1629 1640 $this->core->callBehavior('coreAfterScheduledEntriesPublish',$this,$to_change); 1630 } 1631 1641 1642 $this->firstPublicationEntries($to_change); 1643 } 1644 } 1645 1646 /** 1647 First publication mecanism (on post create, update, publish, status) 1648 1649 @param ids <b>mixed</b> Post(s) ID(s) 1650 */ 1651 public function firstPublicationEntries($ids) 1652 { 1653 $posts = $this->getPosts(array( 1654 'post_id' => dcUtils::cleanIds($ids), 1655 'post_status' => 1, 1656 'post_firstpub' => 0 1657 )); 1658 1659 $to_change = array(); 1660 while($posts->fetch()) { 1661 1662 $to_change[] = $posts->post_id; 1663 } 1664 1665 if (count($to_change)) { 1666 1667 $strReq = 1668 'UPDATE '.$this->prefix.'post '. 1669 'SET post_firstpub = 1 '. 1670 "WHERE blog_id = '".$this->con->escape($this->id)."' ". 1671 'AND post_id '.$this->con->in((array)$to_change).' '; 1672 $this->con->execute($strReq); 1673 1674 # --BEHAVIOR-- coreFirstPublicationEntries 1675 $this->core->callBehavior('coreFirstPublicationEntries',$this,$to_change); 1676 } 1632 1677 } 1633 1678 … … 1760 1805 1761 1806 $cur->post_words = implode(' ',text::splitWords($words)); 1807 } 1808 1809 if ($cur->isField('post_firstpub')) { 1810 $cur->unsetField('post_firstpub'); 1762 1811 } 1763 1812 } -
inc/dbschema/db-schema.php
r3231 r3423 121 121 ->post_words ('text', 0, true, null) 122 122 ->post_status ('smallint', 0, false, 0) 123 ->post_firstpub ('smallint', 0, false, 0) 123 124 ->post_selected ('smallint', 0, false, 0) 124 125 ->post_position ('integer', 0, false, 0) -
inc/dbschema/upgrade.php
r3420 r3423 610 610 $core->con->execute($strReq); 611 611 612 # Update first publication on published posts 613 $strReq = 'UPDATE '.$core->prefix.'post '. 614 'SET post_firstpub = 1 '. 615 'WHERE post_status = 1 '; 616 $core->con->execute($strReq); 617 612 618 # A bit of housecleaning for no longer needed files 613 619 $remfiles = array (
Note: See TracChangeset
for help on using the changeset viewer.