Changeset 2921 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 09/26/2005 11:55:36 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r2901 r2921 61 61 add_meta($post_ID); 62 62 63 // Reunite any orphaned subposts with their parent 64 if ( $_POST['temp_ID'] ) 65 relocate_children($_POST['temp_ID'], $post_ID); 66 63 67 return $post_ID; 68 } 69 70 // Move child posts to a new parent 71 function relocate_children($old_ID, $new_ID) { 72 global $wpdb; 73 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID"); 64 74 } 65 75 … … 1740 1750 return $ct; 1741 1751 } 1752 1753 // Returns an array containing the current upload directory's path and url, or an error message. 1754 function wp_upload_dir() { 1755 if ( defined('UPLOADS') ) 1756 $dir = UPLOADS; 1757 else 1758 $dir = 'wp-content/uploads'; 1759 1760 $path = ABSPATH . $dir; 1761 1762 // Make sure we have an uploads dir 1763 if ( ! file_exists( $path ) ) { 1764 if ( ! mkdir( $path ) ) 1765 return array('error' => "Unable to create directory $path. Is its parent directory writable by the server?"); 1766 @ chmod( ABSPATH . $path, 0774 ); 1767 } 1768 1769 // Generate the yearly and monthly dirs 1770 $time = current_time( 'mysql' ); 1771 $y = substr( $time, 0, 4 ); 1772 $m = substr( $time, 5, 2 ); 1773 $pathy = "$path/$y"; 1774 $pathym = "$path/$y/$m"; 1775 1776 // Make sure we have a yearly dir 1777 if ( ! file_exists( $pathy ) ) { 1778 if ( ! mkdir( $pathy ) ) 1779 return array('error' => "Unable to create directory $pathy. Is $path writable?"); 1780 @ chmod( $pathy, 0774 ); 1781 } 1782 1783 // Make sure we have a monthly dir 1784 if ( ! file_exists( $pathym ) ) { 1785 if ( ! mkdir( $pathym ) ) 1786 return array('error' => "Unable to create directory $pathym. Is $pathy writable?"); 1787 @ chmod( $pathym, 0774 ); 1788 } 1789 1790 $uploads = array('path' => $pathym, 'url' => get_bloginfo('home') . "/$dir/$y/$m", 'error' => false); 1791 return apply_filters('upload_dir', $uploads); 1792 } 1793 1742 1794 ?>
Note: See TracChangeset
for help on using the changeset viewer.