@@ -910,34 +892,13 @@ function node_page_title(NodeInterface $node) {
*
* @return string
* A unix timestamp indicating the last time the node was changed.
*/
functionnode_last_changed($nid,$langcode=NULL){
if(isset($langcode)){
$result=db_query('SELECT changed FROM {node_field_data} WHERE nid = :nid AND langcode = :langcode',array(':nid'=>$nid,':langcode'=>$langcode))->fetch();
}
else{
$result=db_query('SELECT changed FROM {node_field_data} WHERE nid = :nid AND default_langcode = :default_langcode',array(':nid'=>$nid,':default_langcode'=>1))->fetch();
}
returnis_object($result)?$result->changed:FALSE;
}
/**
* Returns a list of all the existing revision numbers for the node passed in.
*
* @param \Drupal\node\NodeInterface $node
* The node entity.
*
* @return
* An associative array keyed by node revision number.
* @todo Remove once https://drupal.org/node/2002180 is resolved. It's only used
* for validation, which will be done by EntityChangedConstraintValidator.
*/
functionnode_revision_list(NodeInterface$node){
$revisions=array();
$result=db_query('SELECT nr.vid, nfr.title, nr.log, nr.revision_uid AS uid, n.vid AS current_vid, nr.revision_timestamp, u.name FROM {node_field_revision} nfr JOIN {node_revision} nr ON nr.vid = nfr.vid LEFT JOIN {node} n ON n.vid = nfr.vid INNER JOIN {users} u ON u.uid = nr.revision_uid WHERE nfr.nid = :nid AND nfr.default_langcode = 1 ORDER BY nfr.vid DESC',array(':nid'=>$node->id()));
// If the user is able to view their own unpublished nodes, allow them
// to see these in addition to published nodes. Check that they actually
// have some unpublished nodes to view before adding the condition.
if(user_access('view own unpublished content')&&$own_unpublished=db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status',array(':uid'=>\Drupal::currentUser()->id(),':status'=>NODE_NOT_PUBLISHED))->fetchCol()){
$query->condition(db_or()
->condition('n.status',NODE_PUBLISHED)
->condition('n.nid',$own_unpublished,'IN')
);
$access_query=\Drupal::entityQuery('node')
->condition('uid',$account->id())
->condition('status',NODE_NOT_PUBLISHED);
if($account->hasPermission('view own unpublished content')&&($own_unpublished=$access_query->execute())){