• About
  • Everyday Linux Commands

<roughCode/>

~ …so I can find it

Category Archives: WordPress

..hacking core (WP)

26 Thursday Jul 2012

Posted by Scott in CMS, Code Samples, WordPress

≈ Comments Off on ..hacking core (WP)

Tags

WordPress

Due to a quirk of my Windows shared hosting provider that is impacting one WordPress blog and not another…I hacked functions.php.  Now, as with hacking Drupal core, I’m not proud of this, but despite the fact that both sites claim to be reading the same php.ini file, one has the open_basedir restriction in effect, and the other does not.  So here’s my hack to get around image uploads blowing up because IIS is putting them in temp and php can’t get there…

// /wp-includes/functions.php
// ~ line 1716

function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {

	$proper_filename = false;

	// Do basic extension validation and MIME mapping
	$wp_filetype = wp_check_filetype( $filename, $mimes );
	extract( $wp_filetype );

// hack
return compact( 'ext', 'type', 'proper_filename' );

	// We can't do any further validation without a file to work with
	if ( ! file_exists( $file ) )
		return compact( 'ext', 'type', 'proper_filename' );

In case there’s any question, dropping a custom php.ini into the web root didn’t work. Neither did one in each folder, or in the cgi folder or anywhere else I could think to stuff a php.ini…

Advertisement

Error updating WP site

18 Wednesday Jul 2012

Posted by Scott in CMS, WordPress

≈ Comments Off on Error updating WP site

Tags

WordPress

Got this error trying to update a WordPress site, and I didn’t want to lose all the content.  What error?

Unable to locate WordPress root directory

Given that I use a Windows host (don’t start on me, I’ve used them since, like, 2001), it’s obviously permissions.  The site in question (not this one, so don’t go playin’) had WP installed in a sub-folder, so I brute forced the permissions there and the upgrade worked.  Now I just need to tighten up security back to what it SHOULD be 😦

Recent Posts

  • Bulk commands to install PHP and MySQL on CentOS 7
  • Four year gap? No, had just been self-hosting for a while
  • winhttpcertcfg.exe Example
  • Configure Tomcat 7 to use HTTPS
  • SCP on Mac (and a tool for Windows)

Archives

  • November 2018
  • October 2018
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012

Categories

  • Apache Tomcat
  • Apache Web Server
  • Application Servers
  • C#
  • CMS
  • Code Samples
  • Databases
  • Development Tools
  • Drupal
  • IIS
  • Java
  • Linux / UNIX
  • MS SQL Server
  • Networking
  • Operating Systems
  • Oracle
  • Uncategorized
  • Video Games
  • Windows
  • WordPress

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • <roughCode/>
    • Already have a WordPress.com account? Log in now.
    • <roughCode/>
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar