Skip to content

Commit

Permalink
Specify $create_dir=false in calls to wp_upload_dir().
Browse files Browse the repository at this point in the history
Calls to this function in Anthologize are used to build cache and temp paths.
As such, they never rely on the existence of the year/month directories that
WordPress creates when `wp_upload_dir()` is called with default parameters.
  • Loading branch information
boonebgorges committed Oct 28, 2019
1 parent f39003d commit 9942e4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion anthologize.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function __construct() {
$this->plugin_url = plugin_dir_url( __FILE__ );
$this->includes_dir = trailingslashit( $this->plugin_dir . 'includes' );

$upload_dir = wp_upload_dir();
$upload_dir = wp_upload_dir( null, false );
$this->cache_dir = trailingslashit( $upload_dir['basedir'] . '/anthologize-cache' );
$this->cache_url = trailingslashit( $upload_dir['baseurl'] . '/anthologize-cache' );

Expand Down
2 changes: 1 addition & 1 deletion templates/epub/includes/class-epub-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function saveImage($image_url, $image_filename) {

public function createDirs() {

$upload_dir = wp_upload_dir();
$upload_dir = wp_upload_dir( null, false );
$tempDir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'anthologize-temp';
if(! is_dir($tempDir)) {
mkdir($tempDir);
Expand Down
4 changes: 2 additions & 2 deletions templates/rtf/class-rtf-anthologizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ protected function getImageHexCodeOld($filename) {
// (this is the only format that seems to work consistently in Word)

protected function getImageHexCode($filename) {
$upload_dir_array = wp_upload_dir();

$upload_dir_array = wp_upload_dir( null, false );
$tempImageFilename = $upload_dir_array['basedir'] . DIRECTORY_SEPARATOR . 'anthologize-rtf-temp-img.png';

// TODO: get image and save to temp file
Expand Down

0 comments on commit 9942e4d

Please sign in to comment.