private function TweetFeed::checkPath in Tweet Feed 8.3
Same name and namespace in other branches
- 4.x src/Controller/TweetFeed.php \Drupal\tweet_feed\Controller\TweetFeed::checkPath()
Make sure the directory exists. If not, create it
Parameters
string $uri: The URI location of the path to be created.
bool $add_date: Do we add the year and month on to the end of the path?
Return value
bool $exists If the real_path exists, then return TRUE
2 calls to TweetFeed::checkPath()
- TweetFeed::processTwitterImage in src/
Controller/ TweetFeed.php - Process Images from URL
- TweetFeed::saveTweet in src/
Controller/ TweetFeed.php - Save the tweet to our tweet entity.
File
- src/
Controller/ TweetFeed.php, line 534
Class
- TweetFeed
- Class TweetFeed.
Namespace
Drupal\tweet_feed\ControllerCode
private function checkPath($uri, $add_date = FALSE) {
$date = !empty($add_date) ? '/' . date('Y-m') : NULL;
$real_path = \Drupal::service('file_system')
->realpath($uri) . $date;
if (!file_exists($real_path)) {
mkdir($real_path, 0777, TRUE);
}
return file_exists($real_path);
}