Exemplo n.º 1
0
 /**
  * Adds the provided blob to the tree.
  *
  * @param WordPress_GitHub_Sync_Blob $blob Blob to add to tree.
  *
  * @return $this
  */
 public function add_blob(WordPress_GitHub_Sync_Blob $blob)
 {
     $this->paths[$blob->path()] = $this->shas[$blob->sha()] = $blob;
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Checks whether the provided blob should be imported.
  *
  * @param WordPress_GitHub_Sync_Blob $blob Blob to validate.
  *
  * @return bool
  */
 protected function importable_blob(WordPress_GitHub_Sync_Blob $blob)
 {
     global $wpdb;
     // Skip the repo's readme.
     if ('readme' === strtolower(substr($blob->path(), 0, 6))) {
         return false;
     }
     // If the blob sha already matches a post, then move on.
     if (!is_wp_error($this->app->database()->fetch_by_sha($blob->sha()))) {
         return false;
     }
     if (!$blob->has_frontmatter()) {
         return false;
     }
     return true;
 }