2. Über uns
Simon
Neidhold
Stefan
Wiegreffe
So&ware
Engineer
Team
Lead
Web
Development
simon.neidhold@icans-‐gmbh.com
stefan.wiegreffe@icans-‐gmbh.com
@sneidhold
@swiegreffe
2
2
8. Standard-Template: index.php
<?php!
/**!
* The main template file.!
*!
* This is the most generic template file in a WordPress theme [...].!
*!
* @package WordPress!
* @subpackage Twenty_Eleven!
*/!
!
get_header(); ?>!
!
<div id="primary">!
<div id="content" role="main">!
!
<?php if ( have_posts() ) : ?>!
!
<?php twentyeleven_content_nav( 'nav-above' ); ?>!
!
<?php /* Start the Loop */ ?>!
<?php while ( have_posts() ) : the_post(); ?>!
!
<?php get_template_part( 'content', get_post_format() ); ?>!
!
<?php endwhile; ?>!
!
[...]!
8
8
9. the_post()
the_post()
ist
deklariert
in
Zeile
773
in
wp-‐includes/query.php:
/**!
* Iterate the post index in the loop.!
*!
* @see WP_Query::the_post()!
* @since 1.5.0!
* @uses $wp_query!
*/!
function the_post() {!
global $wp_query;!
!
$wp_query->the_post();!
}!
9
9
10. WTF??
WP_Query::the_post()
ist
deklariert
in
Zeile
2778
in
wp-‐includes/query.php:
class WP_Query {!
!
/**!
* Sets up the current post.!
*!
* Retrieves the next post, sets up the post, sets the 'in the loop'!
* property to true.!
*!
* @since 1.5.0!
* @access public!
* @uses $post!
* @uses do_action_ref_array() Calls 'loop_start' if loop has just started!
*/!
function the_post() {!
global $post;!
$this->in_the_loop = true;!
!
if ( $this->current_post == -1 ) // loop has just started!
do_action_ref_array('loop_start', array(&$this));!
!
$post = $this->next_post();!
setup_postdata($post);!
}!
!
}
10
10
14. Twitter JSON API
{!
"completed_in":0.209,!
"max_id":141283786544513025,!
"max_id_str":"141283786544513025",!
"next_page":"?page=2&max_id=141283786544513025&q=php%20sucks&rpp=1",!
"page":1,!
"query":"php+sucks",!
"refresh_url":"?since_id=141283786544513025&q=php%20sucks",!
"results":[{"created_at":"Mon,!
28 Nov 2011 22:34:14 +0000",!
"from_user":"infomancien",!
"from_user_id":79284740,!
"from_user_id_str":"79284740",!
"from_user_name":"Infomancien",!
"geo":null,!
"id":141283786544513025,!
"id_str":"141283786544513025",!
"iso_language_code":"en",!
"metadata":{"result_type":"recent"},!
"profile_image_url":"http://a3.twimg.com/[...]/alicelascombe_normal.png",!
"source":"<a href="http://www.hootsuite.com[...]",!
"text":"(@rww) Entrepreneurship Sucks - The sad state of affairs is that working !
for yourself is really just a worse version... http://t.co/BEctTyFw",!
"to_user":null,!
"to_user_id":null,!
"to_user_id_str":null,!
"to_user_name":null}],!
"results_per_page":1,!
"since_id":0,!
"since_id_str":"0"!
}!
14
14
17. Das finale Produkt mit echter Technologien umsetzen
§ Enterprise-Grade Application Server
§ Spring
§ Java Server Faces
§ Hibernate
§ Junit
17
17
32. ID-Check: Requirements
§ Privacy CASE STUDY
• Nur Thumbnail nach extern ausliefern
• nur an den Uploader
§ Performance
• Uploads (bis 20MB JPEG) in 2 Größen umrechnen
• Erwartete Last:
- Max. 10.000 Bilder / Tag
- Max. 4.000 Bilder / Stunde
§ Security
• Lastkontrolle / Missbrauch verhindern
• Viren-Check
§ Funktional
• Thumbnail für User
• Preview in mittlerer Größe
32
32
33. ID-Check: Basic Setup
CASE STUDY
ID-Check Server
API
HTTP HTTP
AJAX Proxy
Backoffice
Frontend
33
33
34. ID-Check: XSRF-Protection
CASE STUDY
ID-Check Server
Validate
Datenbank Token
API
Create HTTP HTTP
Token
AJAX Proxy
Backoffice
Frontend
34
34
35. Uploads von nicht angemeldeten Usern verhindern
CASE STUDY
Check
SSO Service Login
State
ID-Check Server
Validate
Datenbank Token
API
Check
Login
State
Create HTTP HTTP
Token
AJAX Proxy
Backoffice
Frontend
35
35
36. ID-Check: Performance / Skalierung
CASE STUDY
§ 4 Worker / 4 Kerne
§ Synchroner Prozess für Anti-Virus und Thumbnail
§ Asynchron für mittlere Größe
36
36
37. ID-Check: Fazit
CASE STUDY
§ Entwicklungszeit: 8 Wochen
§ Server virtualisiert ohne Last-Probleme
37
37
40. Roundup
§ Man kann in jeder Sprache Schrott machen
§ Der Entwickler macht den Unterschied
§ Die gewählte Architektur ist wichtiger als die gewählte Sprache
§ Für ICANS ist PHP auch langfristig die richtige Entscheidung
40
40